Home | History | Annotate | Download | only in default
      1 /*
      2  * Copyright (C) 2016 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #ifndef ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
     18 #define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
     19 
     20 #include <android/hardware/audio/effect/2.0/IAcousticEchoCancelerEffect.h>
     21 #include <hidl/Status.h>
     22 
     23 #include <hidl/MQDescriptor.h>
     24 
     25 #include "Effect.h"
     26 
     27 namespace android {
     28 namespace hardware {
     29 namespace audio {
     30 namespace effect {
     31 namespace V2_0 {
     32 namespace implementation {
     33 
     34 using ::android::hardware::audio::effect::V2_0::IAcousticEchoCancelerEffect;
     35 using ::android::hardware::audio::effect::V2_0::Result;
     36 using ::android::hardware::Return;
     37 using ::android::hardware::Void;
     38 using ::android::hardware::hidl_vec;
     39 using ::android::hardware::hidl_string;
     40 using ::android::sp;
     41 
     42 struct AcousticEchoCancelerEffect : public IAcousticEchoCancelerEffect {
     43     explicit AcousticEchoCancelerEffect(effect_handle_t handle);
     44 
     45     // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
     46     Return<Result> init()  override;
     47     Return<Result> setConfig(
     48             const EffectConfig& config,
     49             const sp<IEffectBufferProviderCallback>& inputBufferProvider,
     50             const sp<IEffectBufferProviderCallback>& outputBufferProvider)  override;
     51     Return<Result> reset()  override;
     52     Return<Result> enable()  override;
     53     Return<Result> disable()  override;
     54     Return<Result> setDevice(AudioDevice device)  override;
     55     Return<void> setAndGetVolume(
     56             const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb)  override;
     57     Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes)  override;
     58     Return<Result> setAudioMode(AudioMode mode)  override;
     59     Return<Result> setConfigReverse(
     60             const EffectConfig& config,
     61             const sp<IEffectBufferProviderCallback>& inputBufferProvider,
     62             const sp<IEffectBufferProviderCallback>& outputBufferProvider)  override;
     63     Return<Result> setInputDevice(AudioDevice device)  override;
     64     Return<void> getConfig(getConfig_cb _hidl_cb)  override;
     65     Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb)  override;
     66     Return<void> getSupportedAuxChannelsConfigs(
     67             uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb)  override;
     68     Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb)  override;
     69     Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config)  override;
     70     Return<Result> setAudioSource(AudioSource source)  override;
     71     Return<Result> offload(const EffectOffloadParameter& param)  override;
     72     Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
     73     Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb)  override;
     74     Return<Result> setProcessBuffers(
     75             const AudioBuffer& inBuffer, const AudioBuffer& outBuffer)  override;
     76     Return<void> command(
     77             uint32_t commandId,
     78             const hidl_vec<uint8_t>& data,
     79             uint32_t resultMaxSize,
     80             command_cb _hidl_cb)  override;
     81     Return<Result> setParameter(
     82             const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value)  override;
     83     Return<void> getParameter(
     84             const hidl_vec<uint8_t>& parameter,
     85             uint32_t valueMaxSize,
     86             getParameter_cb _hidl_cb)  override;
     87     Return<void> getSupportedConfigsForFeature(
     88             uint32_t featureId,
     89             uint32_t maxConfigs,
     90             uint32_t configSize,
     91             getSupportedConfigsForFeature_cb _hidl_cb)  override;
     92     Return<void> getCurrentConfigForFeature(
     93             uint32_t featureId,
     94             uint32_t configSize,
     95             getCurrentConfigForFeature_cb _hidl_cb)  override;
     96     Return<Result> setCurrentConfigForFeature(
     97             uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
     98     Return<Result> close()  override;
     99 
    100     // Methods from ::android::hardware::audio::effect::V2_0::IAcousticEchoCancelerEffect follow.
    101     Return<Result> setEchoDelay(uint32_t echoDelayMs)  override;
    102     Return<void> getEchoDelay(getEchoDelay_cb _hidl_cb)  override;
    103 
    104   private:
    105     sp<Effect> mEffect;
    106 
    107     virtual ~AcousticEchoCancelerEffect();
    108 };
    109 
    110 }  // namespace implementation
    111 }  // namespace V2_0
    112 }  // namespace effect
    113 }  // namespace audio
    114 }  // namespace hardware
    115 }  // namespace android
    116 
    117 #endif  // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_ACOUSTICECHOCANCELEREFFECT_H
    118