blob: 11853c3392471a7309c32348b05dbf981a6aceb0 [file] [log] [blame]
Mikhail Naganovc9e16072020-08-11 23:23:16 +00001/*
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/IEqualizerEffect.h>
20
21#include "Effect.h"
22
23namespace android::hardware::audio::effect::V7_0::implementation {
24
25class EqualizerEffect : public IEqualizerEffect {
26 public:
27 static const EffectDescriptor& getDescriptor();
28
29 EqualizerEffect();
30
31 // Methods from IEffect interface.
32 ::android::hardware::Return<Result> init() override { return mEffect->init(); }
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 }
39 ::android::hardware::Return<Result> reset() override { return mEffect->reset(); }
40 ::android::hardware::Return<Result> enable() override { return mEffect->enable(); }
41 ::android::hardware::Return<Result> disable() override { return mEffect->disable(); }
42 ::android::hardware::Return<Result> setDevice(
43 const ::android::hardware::audio::common::V7_0::DeviceAddress& device) override {
44 return mEffect->setDevice(device);
45 }
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 }
51 ::android::hardware::Return<Result> volumeChangeNotification(
52 const ::android::hardware::hidl_vec<uint32_t>& volumes) override {
53 return mEffect->volumeChangeNotification(volumes);
54 }
55 ::android::hardware::Return<Result> setAudioMode(
56 ::android::hardware::audio::common::V7_0::AudioMode mode) override {
57 return mEffect->setAudioMode(mode);
58 }
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 }
65 ::android::hardware::Return<Result> setInputDevice(
66 const ::android::hardware::audio::common::V7_0::DeviceAddress& device) override {
67 return mEffect->setInputDevice(device);
68 }
69 ::android::hardware::Return<void> getConfig(getConfig_cb _hidl_cb) override {
70 return mEffect->getConfig(_hidl_cb);
71 }
72 ::android::hardware::Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override {
73 return mEffect->getConfigReverse(_hidl_cb);
74 }
75 ::android::hardware::Return<void> getSupportedAuxChannelsConfigs(
76 uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override {
77 return mEffect->getSupportedAuxChannelsConfigs(maxConfigs, _hidl_cb);
78 }
79 ::android::hardware::Return<void> getAuxChannelsConfig(
80 getAuxChannelsConfig_cb _hidl_cb) override {
81 return mEffect->getAuxChannelsConfig(_hidl_cb);
82 }
83 ::android::hardware::Return<Result> setAuxChannelsConfig(
84 const EffectAuxChannelsConfig& config) override {
85 return mEffect->setAuxChannelsConfig(config);
86 }
87 ::android::hardware::Return<Result> setAudioSource(
88 const ::android::hardware::hidl_string& source) override {
89 return mEffect->setAudioSource(source);
90 }
91 ::android::hardware::Return<Result> offload(const EffectOffloadParameter& param) override {
92 return mEffect->offload(param);
93 }
94 ::android::hardware::Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override {
95 return mEffect->getDescriptor(_hidl_cb);
96 }
97 ::android::hardware::Return<void> prepareForProcessing(
98 prepareForProcessing_cb _hidl_cb) override {
99 return mEffect->prepareForProcessing(_hidl_cb);
100 }
101 ::android::hardware::Return<Result> setProcessBuffers(const AudioBuffer& inBuffer,
102 const AudioBuffer& outBuffer) override {
103 return mEffect->setProcessBuffers(inBuffer, outBuffer);
104 }
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 }
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 }
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 }
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 }
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 }
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 }
135 ::android::hardware::Return<Result> close() override { return mEffect->close(); }
136
137 // Methods from IEqualizerEffect interface.
138 ::android::hardware::Return<void> getNumBands(getNumBands_cb _hidl_cb) override;
139 ::android::hardware::Return<void> getLevelRange(getLevelRange_cb _hidl_cb) override;
140 ::android::hardware::Return<Result> setBandLevel(uint16_t band, int16_t level) override;
141 ::android::hardware::Return<void> getBandLevel(uint16_t band,
142 getBandLevel_cb _hidl_cb) override;
143 ::android::hardware::Return<void> getBandCenterFrequency(
144 uint16_t band, getBandCenterFrequency_cb _hidl_cb) override;
145 ::android::hardware::Return<void> getBandFrequencyRange(
146 uint16_t band, getBandFrequencyRange_cb _hidl_cb) override;
147 ::android::hardware::Return<void> getBandForFrequency(uint32_t freq,
148 getBandForFrequency_cb _hidl_cb) override;
149 ::android::hardware::Return<void> getPresetNames(getPresetNames_cb _hidl_cb) override;
150 ::android::hardware::Return<Result> setCurrentPreset(uint16_t preset) override;
151 ::android::hardware::Return<void> getCurrentPreset(getCurrentPreset_cb _hidl_cb) override;
152 ::android::hardware::Return<Result> setAllProperties(
153 const IEqualizerEffect::AllProperties& properties) override;
154 ::android::hardware::Return<void> getAllProperties(getAllProperties_cb _hidl_cb) override;
155
156 private:
157 static constexpr size_t kNumBands = 1;
158 static constexpr size_t kNumPresets = 1;
159 sp<Effect> mEffect;
160 IEqualizerEffect::AllProperties mProperties{};
161};
162
163} // namespace android::hardware::audio::effect::V7_0::implementation