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_BASSBOOSTEFFECT_H
18#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
19
20#include <android/hardware/audio/effect/2.0/IBassBoostEffect.h>
21#include <hidl/Status.h>
22
23#include <hidl/MQDescriptor.h>
24
25#include "Effect.h"
26
27namespace android {
28namespace hardware {
29namespace audio {
30namespace effect {
31namespace V2_0 {
32namespace implementation {
33
34using ::android::hardware::audio::effect::V2_0::IBassBoostEffect;
35using ::android::hardware::audio::effect::V2_0::Result;
36using ::android::hardware::Return;
37using ::android::hardware::Void;
38using ::android::hardware::hidl_vec;
39using ::android::hardware::hidl_string;
40using ::android::sp;
41
42struct BassBoostEffect : public IBassBoostEffect {
43    explicit BassBoostEffect(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::IBassBoostEffect follow.
101    Return<void> isStrengthSupported(isStrengthSupported_cb _hidl_cb)  override;
102    Return<Result> setStrength(uint16_t strength)  override;
103    Return<void> getStrength(getStrength_cb _hidl_cb)  override;
104
105  private:
106    sp<Effect> mEffect;
107
108    virtual ~BassBoostEffect();
109};
110
111}  // namespace implementation
112}  // namespace V2_0
113}  // namespace effect
114}  // namespace audio
115}  // namespace hardware
116}  // namespace android
117
118#endif  // ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_BASSBOOSTEFFECT_H
119