1 /* 2 * Copyright (C) 2020 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 #pragma once 18 19 #include <android/hardware/audio/effect/7.0/ILoudnessEnhancerEffect.h> 20 21 #include "Effect.h" 22 23 namespace android::hardware::audio::effect::V7_0::implementation { 24 25 class LoudnessEnhancerEffect : public ILoudnessEnhancerEffect { 26 public: 27 static const EffectDescriptor& getDescriptor(); 28 29 LoudnessEnhancerEffect(); 30 31 // Methods from IEffect interface. init()32 ::android::hardware::Return<Result> init() override { return mEffect->init(); } setConfig(const EffectConfig & config,const::android::sp<IEffectBufferProviderCallback> & inputBufferProvider,const::android::sp<IEffectBufferProviderCallback> & outputBufferProvider)33 ::android::hardware::Return<Result> setConfig( 34 const EffectConfig& config, 35 const ::android::sp<IEffectBufferProviderCallback>& inputBufferProvider, 36 const ::android::sp<IEffectBufferProviderCallback>& outputBufferProvider) override { 37 return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider); 38 } reset()39 ::android::hardware::Return<Result> reset() override { return mEffect->reset(); } enable()40 ::android::hardware::Return<Result> enable() override { return mEffect->enable(); } disable()41 ::android::hardware::Return<Result> disable() override { return mEffect->disable(); } setDevice(const::android::hardware::audio::common::V7_0::DeviceAddress & device)42 ::android::hardware::Return<Result> setDevice( 43 const ::android::hardware::audio::common::V7_0::DeviceAddress& device) override { 44 return mEffect->setDevice(device); 45 } setAndGetVolume(const::android::hardware::hidl_vec<uint32_t> & volumes,setAndGetVolume_cb _hidl_cb)46 ::android::hardware::Return<void> setAndGetVolume( 47 const ::android::hardware::hidl_vec<uint32_t>& volumes, 48 setAndGetVolume_cb _hidl_cb) override { 49 return mEffect->setAndGetVolume(volumes, _hidl_cb); 50 } volumeChangeNotification(const::android::hardware::hidl_vec<uint32_t> & volumes)51 ::android::hardware::Return<Result> volumeChangeNotification( 52 const ::android::hardware::hidl_vec<uint32_t>& volumes) override { 53 return mEffect->volumeChangeNotification(volumes); 54 } setAudioMode(::android::hardware::audio::common::V7_0::AudioMode mode)55 ::android::hardware::Return<Result> setAudioMode( 56 ::android::hardware::audio::common::V7_0::AudioMode mode) override { 57 return mEffect->setAudioMode(mode); 58 } setConfigReverse(const EffectConfig & config,const::android::sp<IEffectBufferProviderCallback> & inputBufferProvider,const::android::sp<IEffectBufferProviderCallback> & outputBufferProvider)59 ::android::hardware::Return<Result> setConfigReverse( 60 const EffectConfig& config, 61 const ::android::sp<IEffectBufferProviderCallback>& inputBufferProvider, 62 const ::android::sp<IEffectBufferProviderCallback>& outputBufferProvider) override { 63 return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider); 64 } setInputDevice(const::android::hardware::audio::common::V7_0::DeviceAddress & device)65 ::android::hardware::Return<Result> setInputDevice( 66 const ::android::hardware::audio::common::V7_0::DeviceAddress& device) override { 67 return mEffect->setInputDevice(device); 68 } getConfig(getConfig_cb _hidl_cb)69 ::android::hardware::Return<void> getConfig(getConfig_cb _hidl_cb) override { 70 return mEffect->getConfig(_hidl_cb); 71 } getConfigReverse(getConfigReverse_cb _hidl_cb)72 ::android::hardware::Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override { 73 return mEffect->getConfigReverse(_hidl_cb); 74 } getSupportedAuxChannelsConfigs(uint32_t maxConfigs,getSupportedAuxChannelsConfigs_cb _hidl_cb)75 ::android::hardware::Return<void> getSupportedAuxChannelsConfigs( 76 uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override { 77 return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb); 78 } getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb)79 ::android::hardware::Return<void> getAuxChannelsConfig( 80 getAuxChannelsConfig_cb _hidl_cb) override { 81 return mEffect->getAuxChannelsConfig(_hidl_cb); 82 } setAuxChannelsConfig(const EffectAuxChannelsConfig & config)83 ::android::hardware::Return<Result> setAuxChannelsConfig( 84 const EffectAuxChannelsConfig& config) override { 85 return mEffect->setAuxChannelsConfig(config); 86 } setAudioSource(const::android::hardware::hidl_string & source)87 ::android::hardware::Return<Result> setAudioSource( 88 const ::android::hardware::hidl_string& source) override { 89 return mEffect->setAudioSource(source); 90 } offload(const EffectOffloadParameter & param)91 ::android::hardware::Return<Result> offload(const EffectOffloadParameter& param) override { 92 return mEffect->offload(param); 93 } getDescriptor(getDescriptor_cb _hidl_cb)94 ::android::hardware::Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override { 95 return mEffect->getDescriptor(_hidl_cb); 96 } prepareForProcessing(prepareForProcessing_cb _hidl_cb)97 ::android::hardware::Return<void> prepareForProcessing( 98 prepareForProcessing_cb _hidl_cb) override { 99 return mEffect->prepareForProcessing(_hidl_cb); 100 } setProcessBuffers(const AudioBuffer & inBuffer,const AudioBuffer & outBuffer)101 ::android::hardware::Return<Result> setProcessBuffers(const AudioBuffer& inBuffer, 102 const AudioBuffer& outBuffer) override { 103 return mEffect->setProcessBuffers(inBuffer, outBuffer); 104 } command(uint32_t commandId,const::android::hardware::hidl_vec<uint8_t> & data,uint32_t resultMaxSize,command_cb _hidl_cb)105 ::android::hardware::Return<void> command(uint32_t commandId, 106 const ::android::hardware::hidl_vec<uint8_t>& data, 107 uint32_t resultMaxSize, 108 command_cb _hidl_cb) override { 109 return mEffect->command(commandId, data, resultMaxSize, _hidl_cb); 110 } setParameter(const::android::hardware::hidl_vec<uint8_t> & parameter,const::android::hardware::hidl_vec<uint8_t> & value)111 ::android::hardware::Return<Result> setParameter( 112 const ::android::hardware::hidl_vec<uint8_t>& parameter, 113 const ::android::hardware::hidl_vec<uint8_t>& value) override { 114 return mEffect->setParameter(parameter, value); 115 } getParameter(const::android::hardware::hidl_vec<uint8_t> & parameter,uint32_t valueMaxSize,getParameter_cb _hidl_cb)116 ::android::hardware::Return<void> getParameter( 117 const ::android::hardware::hidl_vec<uint8_t>& parameter, uint32_t valueMaxSize, 118 getParameter_cb _hidl_cb) override { 119 return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb); 120 } getSupportedConfigsForFeature(uint32_t featureId,uint32_t maxConfigs,uint32_t configSize,getSupportedConfigsForFeature_cb _hidl_cb)121 ::android::hardware::Return<void> getSupportedConfigsForFeature( 122 uint32_t featureId, uint32_t maxConfigs, uint32_t configSize, 123 getSupportedConfigsForFeature_cb _hidl_cb) override { 124 return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb); 125 } getCurrentConfigForFeature(uint32_t featureId,uint32_t configSize,getCurrentConfigForFeature_cb _hidl_cb)126 ::android::hardware::Return<void> getCurrentConfigForFeature( 127 uint32_t featureId, uint32_t configSize, 128 getCurrentConfigForFeature_cb _hidl_cb) override { 129 return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb); 130 } setCurrentConfigForFeature(uint32_t featureId,const::android::hardware::hidl_vec<uint8_t> & configData)131 ::android::hardware::Return<Result> setCurrentConfigForFeature( 132 uint32_t featureId, const ::android::hardware::hidl_vec<uint8_t>& configData) override { 133 return mEffect->setCurrentConfigForFeature(featureId, configData); 134 } close()135 ::android::hardware::Return<Result> close() override { return mEffect->close(); } 136 137 // Methods from ILoudnessEnhancerEffect interface. 138 ::android::hardware::Return<Result> setTargetGain(int32_t targetGainMb) override; 139 ::android::hardware::Return<void> getTargetGain(getTargetGain_cb _hidl_cb) override; 140 141 private: 142 sp<Effect> mEffect; 143 int32_t mTargetGainMb = 0; 144 }; 145 146 } // namespace android::hardware::audio::effect::V7_0::implementation 147