• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2018 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_BASSBOOSTEFFECT_H
18 #define ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
19 
20 #include PATH(android/hardware/audio/effect/FILE_VERSION/IBassBoostEffect.h)
21 
22 #include <hidl/MQDescriptor.h>
23 
24 #include "Effect.h"
25 
26 #include <hidl/Status.h>
27 
28 #include <hidl/MQDescriptor.h>
29 
30 #include "VersionUtils.h"
31 
32 namespace android {
33 namespace hardware {
34 namespace audio {
35 namespace effect {
36 namespace CPP_VERSION {
37 namespace implementation {
38 
39 using ::android::sp;
40 using ::android::hardware::hidl_string;
41 using ::android::hardware::hidl_vec;
42 using ::android::hardware::Return;
43 using ::android::hardware::Void;
44 using ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect;
45 using ::android::hardware::audio::effect::CPP_VERSION::Result;
46 
47 struct BassBoostEffect : public IBassBoostEffect {
48     explicit BassBoostEffect(effect_handle_t handle);
49 
50     // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow.
51     Return<Result> init() override;
52     Return<Result> setConfig(
53         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
54         const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
55     Return<Result> reset() override;
56     Return<Result> enable() override;
57     Return<Result> disable() override;
58 #if MAJOR_VERSION <= 6
59     Return<Result> setAudioSource(AudioSource source) override;
60     Return<Result> setDevice(AudioDeviceBitfield device) override;
61     Return<Result> setInputDevice(AudioDeviceBitfield device) override;
62 #else
63     Return<Result> setAudioSource(const AudioSource& source) override;
64     Return<Result> setDevice(const DeviceAddress& device) override;
65     Return<Result> setInputDevice(const DeviceAddress& device) override;
66 #endif
67     Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes,
68                                  setAndGetVolume_cb _hidl_cb) override;
69     Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override;
70     Return<Result> setAudioMode(AudioMode mode) override;
71     Return<Result> setConfigReverse(
72         const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider,
73         const sp<IEffectBufferProviderCallback>& outputBufferProvider) override;
74     Return<void> getConfig(getConfig_cb _hidl_cb) override;
75     Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override;
76     Return<void> getSupportedAuxChannelsConfigs(
77         uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override;
78     Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override;
79     Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override;
80     Return<Result> offload(const EffectOffloadParameter& param) override;
81     Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override;
82     Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb) override;
83     Return<Result> setProcessBuffers(const AudioBuffer& inBuffer,
84                                      const AudioBuffer& outBuffer) override;
85     Return<void> command(uint32_t commandId, const hidl_vec<uint8_t>& data, uint32_t resultMaxSize,
86                          command_cb _hidl_cb) override;
87     Return<Result> setParameter(const hidl_vec<uint8_t>& parameter,
88                                 const hidl_vec<uint8_t>& value) override;
89     Return<void> getParameter(const hidl_vec<uint8_t>& parameter, uint32_t valueMaxSize,
90                               getParameter_cb _hidl_cb) override;
91     Return<void> getSupportedConfigsForFeature(uint32_t featureId, uint32_t maxConfigs,
92                                                uint32_t configSize,
93                                                getSupportedConfigsForFeature_cb _hidl_cb) override;
94     Return<void> getCurrentConfigForFeature(uint32_t featureId, uint32_t configSize,
95                                             getCurrentConfigForFeature_cb _hidl_cb) override;
96     Return<Result> setCurrentConfigForFeature(uint32_t featureId,
97                                               const hidl_vec<uint8_t>& configData) override;
98     Return<Result> close() override;
99     Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
100 
101     // Methods from ::android::hardware::audio::effect::CPP_VERSION::IBassBoostEffect follow.
102     Return<void> isStrengthSupported(isStrengthSupported_cb _hidl_cb) override;
103     Return<Result> setStrength(uint16_t strength) override;
104     Return<void> getStrength(getStrength_cb _hidl_cb) override;
105 
106    private:
107     sp<Effect> mEffect;
108 
109     virtual ~BassBoostEffect() = default;
110 };
111 
112 }  // namespace implementation
113 }  // namespace CPP_VERSION
114 }  // namespace effect
115 }  // namespace audio
116 }  // namespace hardware
117 }  // namespace android
118 
119 #endif  // ANDROID_HARDWARE_AUDIO_EFFECT_BASSBOOSTEFFECT_H
120