DownmixEffect.h revision d6e4f03acf5fa1e76b75e33af7a26f248a92be9a
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_DOWNMIXEFFECT_H
18#define ANDROID_HARDWARE_AUDIO_EFFECT_V2_0_DOWNMIXEFFECT_H
19
20#include <android/hardware/audio/effect/2.0/IDownmixEffect.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::IDownmixEffect;
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 DownmixEffect : public IDownmixEffect {
43    explicit DownmixEffect(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> setAudioMode(AudioMode mode)  override;
58    Return<Result> setConfigReverse(
59            const EffectConfig& config,
60            const sp<IEffectBufferProviderCallback>& inputBufferProvider,
61            const sp<IEffectBufferProviderCallback>& outputBufferProvider)  override;
62    Return<Result> setInputDevice(AudioDevice device)  override;
63    Return<void> getConfig(getConfig_cb _hidl_cb)  override;
64    Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb)  override;
65    Return<void> getSupportedAuxChannelsConfigs(
66            uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb)  override;
67    Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb)  override;
68    Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config)  override;
69    Return<Result> setAudioSource(AudioSource source)  override;
70    Return<Result> offload(const EffectOffloadParameter& param)  override;
71    Return<void> getDescriptor(getDescriptor_cb _hidl_cb)  override;
72    Return<void> process(
73            const AudioBuffer& inBuffer, uint32_t outFrameSize, process_cb _hidl_cb)  override;
74    Return<void> processReverse(
75            const AudioBuffer& inBuffer,
76            uint32_t outFrameSize,
77            processReverse_cb _hidl_cb)  override;
78    Return<void> command(
79            uint32_t commandId,
80            const hidl_vec<uint8_t>& data,
81            uint32_t resultMaxSize,
82            command_cb _hidl_cb)  override;
83    Return<Result> setParameter(
84            const hidl_vec<uint8_t>& parameter, const hidl_vec<uint8_t>& value)  override;
85    Return<void> getParameter(
86            const hidl_vec<uint8_t>& parameter,
87            uint32_t valueMaxSize,
88            getParameter_cb _hidl_cb)  override;
89    Return<void> getSupportedConfigsForFeature(
90            uint32_t featureId,
91            uint32_t maxConfigs,
92            uint32_t configSize,
93            getSupportedConfigsForFeature_cb _hidl_cb)  override;
94    Return<void> getCurrentConfigForFeature(
95            uint32_t featureId,
96            uint32_t configSize,
97            getCurrentConfigForFeature_cb _hidl_cb)  override;
98    Return<Result> setCurrentConfigForFeature(
99            uint32_t featureId, const hidl_vec<uint8_t>& configData)  override;
100
101    // Methods from ::android::hardware::audio::effect::V2_0::IDownmixEffect follow.
102    Return<Result> setType(IDownmixEffect::Type preset)  override;
103    Return<void> getType(getType_cb _hidl_cb)  override;
104
105  private:
106    sp<Effect> mEffect;
107
108    virtual ~DownmixEffect();
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_DOWNMIXEFFECT_H
119