• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define LOG_TAG "BassBoost_HAL"
18 #include <system/audio_effects/effect_bassboost.h>
19 #include <android/log.h>
20 
21 #include "BassBoostEffect.h"
22 
23 namespace android {
24 namespace hardware {
25 namespace audio {
26 namespace effect {
27 namespace V2_0 {
28 namespace implementation {
29 
BassBoostEffect(effect_handle_t handle)30 BassBoostEffect::BassBoostEffect(effect_handle_t handle)
31         : mEffect(new Effect(handle)) {
32 }
33 
~BassBoostEffect()34 BassBoostEffect::~BassBoostEffect() {}
35 
36 // Methods from ::android::hardware::audio::effect::V2_0::IEffect follow.
init()37 Return<Result> BassBoostEffect::init() {
38     return mEffect->init();
39 }
40 
setConfig(const EffectConfig & config,const sp<IEffectBufferProviderCallback> & inputBufferProvider,const sp<IEffectBufferProviderCallback> & outputBufferProvider)41 Return<Result> BassBoostEffect::setConfig(
42         const EffectConfig& config,
43         const sp<IEffectBufferProviderCallback>& inputBufferProvider,
44         const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
45     return mEffect->setConfig(config, inputBufferProvider, outputBufferProvider);
46 }
47 
reset()48 Return<Result> BassBoostEffect::reset() {
49     return mEffect->reset();
50 }
51 
enable()52 Return<Result> BassBoostEffect::enable() {
53     return mEffect->enable();
54 }
55 
disable()56 Return<Result> BassBoostEffect::disable() {
57     return mEffect->disable();
58 }
59 
setDevice(AudioDevice device)60 Return<Result> BassBoostEffect::setDevice(AudioDevice device) {
61     return mEffect->setDevice(device);
62 }
63 
setAndGetVolume(const hidl_vec<uint32_t> & volumes,setAndGetVolume_cb _hidl_cb)64 Return<void> BassBoostEffect::setAndGetVolume(
65         const hidl_vec<uint32_t>& volumes, setAndGetVolume_cb _hidl_cb) {
66     return mEffect->setAndGetVolume(volumes, _hidl_cb);
67 }
68 
volumeChangeNotification(const hidl_vec<uint32_t> & volumes)69 Return<Result> BassBoostEffect::volumeChangeNotification(
70         const hidl_vec<uint32_t>& volumes) {
71     return mEffect->volumeChangeNotification(volumes);
72 }
73 
setAudioMode(AudioMode mode)74 Return<Result> BassBoostEffect::setAudioMode(AudioMode mode) {
75     return mEffect->setAudioMode(mode);
76 }
77 
setConfigReverse(const EffectConfig & config,const sp<IEffectBufferProviderCallback> & inputBufferProvider,const sp<IEffectBufferProviderCallback> & outputBufferProvider)78 Return<Result> BassBoostEffect::setConfigReverse(
79         const EffectConfig& config,
80         const sp<IEffectBufferProviderCallback>& inputBufferProvider,
81         const sp<IEffectBufferProviderCallback>& outputBufferProvider) {
82     return mEffect->setConfigReverse(config, inputBufferProvider, outputBufferProvider);
83 }
84 
setInputDevice(AudioDevice device)85 Return<Result> BassBoostEffect::setInputDevice(AudioDevice device) {
86     return mEffect->setInputDevice(device);
87 }
88 
getConfig(getConfig_cb _hidl_cb)89 Return<void> BassBoostEffect::getConfig(getConfig_cb _hidl_cb) {
90     return mEffect->getConfig(_hidl_cb);
91 }
92 
getConfigReverse(getConfigReverse_cb _hidl_cb)93 Return<void> BassBoostEffect::getConfigReverse(getConfigReverse_cb _hidl_cb) {
94     return mEffect->getConfigReverse(_hidl_cb);
95 }
96 
getSupportedAuxChannelsConfigs(uint32_t maxConfigs,getSupportedAuxChannelsConfigs_cb _hidl_cb)97 Return<void> BassBoostEffect::getSupportedAuxChannelsConfigs(
98         uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) {
99     return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
100 }
101 
getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb)102 Return<void> BassBoostEffect::getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) {
103     return mEffect->getAuxChannelsConfig(_hidl_cb);
104 }
105 
setAuxChannelsConfig(const EffectAuxChannelsConfig & config)106 Return<Result> BassBoostEffect::setAuxChannelsConfig(
107         const EffectAuxChannelsConfig& config) {
108     return mEffect->setAuxChannelsConfig(config);
109 }
110 
setAudioSource(AudioSource source)111 Return<Result> BassBoostEffect::setAudioSource(AudioSource source) {
112     return mEffect->setAudioSource(source);
113 }
114 
offload(const EffectOffloadParameter & param)115 Return<Result> BassBoostEffect::offload(const EffectOffloadParameter& param) {
116     return mEffect->offload(param);
117 }
118 
getDescriptor(getDescriptor_cb _hidl_cb)119 Return<void> BassBoostEffect::getDescriptor(getDescriptor_cb _hidl_cb) {
120     return mEffect->getDescriptor(_hidl_cb);
121 }
122 
prepareForProcessing(prepareForProcessing_cb _hidl_cb)123 Return<void> BassBoostEffect::prepareForProcessing(
124         prepareForProcessing_cb _hidl_cb) {
125     return mEffect->prepareForProcessing(_hidl_cb);
126 }
127 
setProcessBuffers(const AudioBuffer & inBuffer,const AudioBuffer & outBuffer)128 Return<Result> BassBoostEffect::setProcessBuffers(
129         const AudioBuffer& inBuffer, const AudioBuffer& outBuffer) {
130     return mEffect->setProcessBuffers(inBuffer, outBuffer);
131 }
132 
command(uint32_t commandId,const hidl_vec<uint8_t> & data,uint32_t resultMaxSize,command_cb _hidl_cb)133 Return<void> BassBoostEffect::command(
134         uint32_t commandId,
135         const hidl_vec<uint8_t>& data,
136         uint32_t resultMaxSize,
137         command_cb _hidl_cb) {
138     return mEffect->command(commandId, data, resultMaxSize, _hidl_cb);
139 }
140 
setParameter(const hidl_vec<uint8_t> & parameter,const hidl_vec<uint8_t> & value)141 Return<Result> BassBoostEffect::setParameter(
142         const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value) {
143     return mEffect->setParameter(parameter, value);
144 }
145 
getParameter(const hidl_vec<uint8_t> & parameter,uint32_t valueMaxSize,getParameter_cb _hidl_cb)146 Return<void> BassBoostEffect::getParameter(
147         const hidl_vec<uint8_t>& parameter,
148         uint32_t valueMaxSize,
149         getParameter_cb _hidl_cb) {
150     return mEffect->getParameter(parameter, valueMaxSize, _hidl_cb);
151 }
152 
getSupportedConfigsForFeature(uint32_t featureId,uint32_t maxConfigs,uint32_t configSize,getSupportedConfigsForFeature_cb _hidl_cb)153 Return<void> BassBoostEffect::getSupportedConfigsForFeature(
154         uint32_t featureId,
155         uint32_t maxConfigs,
156         uint32_t configSize,
157         getSupportedConfigsForFeature_cb _hidl_cb) {
158     return mEffect->getSupportedConfigsForFeature(featureId, maxConfigs, configSize, _hidl_cb);
159 }
160 
getCurrentConfigForFeature(uint32_t featureId,uint32_t configSize,getCurrentConfigForFeature_cb _hidl_cb)161 Return<void> BassBoostEffect::getCurrentConfigForFeature(
162         uint32_t featureId,
163         uint32_t configSize,
164         getCurrentConfigForFeature_cb _hidl_cb) {
165     return mEffect->getCurrentConfigForFeature(featureId, configSize, _hidl_cb);
166 }
167 
setCurrentConfigForFeature(uint32_t featureId,const hidl_vec<uint8_t> & configData)168 Return<Result> BassBoostEffect::setCurrentConfigForFeature(
169         uint32_t featureId, const hidl_vec<uint8_t>& configData) {
170     return mEffect->setCurrentConfigForFeature(featureId, configData);
171 }
172 
close()173 Return<Result> BassBoostEffect::close() {
174     return mEffect->close();
175 }
176 
177 // Methods from ::android::hardware::audio::effect::V2_0::IBassBoostEffect follow.
isStrengthSupported(isStrengthSupported_cb _hidl_cb)178 Return<void> BassBoostEffect::isStrengthSupported(isStrengthSupported_cb _hidl_cb)  {
179     return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH_SUPPORTED, _hidl_cb);
180 }
181 
setStrength(uint16_t strength)182 Return<Result> BassBoostEffect::setStrength(uint16_t strength)  {
183     return mEffect->setParam(BASSBOOST_PARAM_STRENGTH, strength);
184 }
185 
getStrength(getStrength_cb _hidl_cb)186 Return<void> BassBoostEffect::getStrength(getStrength_cb _hidl_cb)  {
187     return mEffect->getIntegerParam(BASSBOOST_PARAM_STRENGTH, _hidl_cb);
188 }
189 
190 } // namespace implementation
191 }  // namespace V2_0
192 }  // namespace effect
193 }  // namespace audio
194 }  // namespace hardware
195 }  // namespace android
196