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_VISUALIZEREFFECT_H 18 #define ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H 19 20 #include PATH(android/hardware/audio/effect/FILE_VERSION/IVisualizerEffect.h) 21 22 #include "Effect.h" 23 24 #include <hidl/Status.h> 25 26 #include <hidl/MQDescriptor.h> 27 28 #include "VersionUtils.h" 29 30 namespace android { 31 namespace hardware { 32 namespace audio { 33 namespace effect { 34 namespace CPP_VERSION { 35 namespace implementation { 36 37 using ::android::sp; 38 using ::android::hardware::hidl_string; 39 using ::android::hardware::hidl_vec; 40 using ::android::hardware::Return; 41 using ::android::hardware::Void; 42 using namespace ::android::hardware::audio::common::CPP_VERSION; 43 using namespace ::android::hardware::audio::effect::CPP_VERSION; 44 45 struct VisualizerEffect : public IVisualizerEffect { 46 explicit VisualizerEffect(effect_handle_t handle); 47 48 // Methods from ::android::hardware::audio::effect::CPP_VERSION::IEffect follow. 49 Return<Result> init() override; 50 Return<Result> setConfig( 51 const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider, 52 const sp<IEffectBufferProviderCallback>& outputBufferProvider) override; 53 Return<Result> reset() override; 54 Return<Result> enable() override; 55 Return<Result> disable() override; 56 Return<Result> setDevice(AudioDeviceBitfield device) override; 57 Return<void> setAndGetVolume(const hidl_vec<uint32_t>& volumes, 58 setAndGetVolume_cb _hidl_cb) override; 59 Return<Result> volumeChangeNotification(const hidl_vec<uint32_t>& volumes) override; 60 Return<Result> setAudioMode(AudioMode mode) override; 61 Return<Result> setConfigReverse( 62 const EffectConfig& config, const sp<IEffectBufferProviderCallback>& inputBufferProvider, 63 const sp<IEffectBufferProviderCallback>& outputBufferProvider) override; 64 Return<Result> setInputDevice(AudioDeviceBitfield device) override; 65 Return<void> getConfig(getConfig_cb _hidl_cb) override; 66 Return<void> getConfigReverse(getConfigReverse_cb _hidl_cb) override; 67 Return<void> getSupportedAuxChannelsConfigs( 68 uint32_t maxConfigs, getSupportedAuxChannelsConfigs_cb _hidl_cb) override; 69 Return<void> getAuxChannelsConfig(getAuxChannelsConfig_cb _hidl_cb) override; 70 Return<Result> setAuxChannelsConfig(const EffectAuxChannelsConfig& config) override; 71 Return<Result> setAudioSource(AudioSource source) override; 72 Return<Result> offload(const EffectOffloadParameter& param) override; 73 Return<void> getDescriptor(getDescriptor_cb _hidl_cb) override; 74 Return<void> prepareForProcessing(prepareForProcessing_cb _hidl_cb) override; 75 Return<Result> setProcessBuffers(const AudioBuffer& inBuffer, 76 const AudioBuffer& outBuffer) override; 77 Return<void> command(uint32_t commandId, const hidl_vec<uint8_t>& data, uint32_t resultMaxSize, 78 command_cb _hidl_cb) override; 79 Return<Result> setParameter(const hidl_vec<uint8_t>& parameter, 80 const hidl_vec<uint8_t>& value) override; 81 Return<void> getParameter(const hidl_vec<uint8_t>& parameter, uint32_t valueMaxSize, 82 getParameter_cb _hidl_cb) override; 83 Return<void> getSupportedConfigsForFeature(uint32_t featureId, uint32_t maxConfigs, 84 uint32_t configSize, 85 getSupportedConfigsForFeature_cb _hidl_cb) override; 86 Return<void> getCurrentConfigForFeature(uint32_t featureId, uint32_t configSize, 87 getCurrentConfigForFeature_cb _hidl_cb) override; 88 Return<Result> setCurrentConfigForFeature(uint32_t featureId, 89 const hidl_vec<uint8_t>& configData) override; 90 Return<Result> close() override; 91 Return<void> debug(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override; 92 93 // Methods from ::android::hardware::audio::effect::CPP_VERSION::IVisualizerEffect follow. 94 Return<Result> setCaptureSize(uint16_t captureSize) override; 95 Return<void> getCaptureSize(getCaptureSize_cb _hidl_cb) override; 96 Return<Result> setScalingMode(IVisualizerEffect::ScalingMode scalingMode) override; 97 Return<void> getScalingMode(getScalingMode_cb _hidl_cb) override; 98 Return<Result> setLatency(uint32_t latencyMs) override; 99 Return<void> getLatency(getLatency_cb _hidl_cb) override; 100 Return<Result> setMeasurementMode(IVisualizerEffect::MeasurementMode measurementMode) override; 101 Return<void> getMeasurementMode(getMeasurementMode_cb _hidl_cb) override; 102 Return<void> capture(capture_cb _hidl_cb) override; 103 Return<void> measure(measure_cb _hidl_cb) override; 104 105 private: 106 sp<Effect> mEffect; 107 uint16_t mCaptureSize; 108 MeasurementMode mMeasurementMode; 109 110 virtual ~VisualizerEffect(); 111 }; 112 113 } // namespace implementation 114 } // namespace CPP_VERSION 115 } // namespace effect 116 } // namespace audio 117 } // namespace hardware 118 } // namespace android 119 120 #endif // ANDROID_HARDWARE_AUDIO_EFFECT_VISUALIZEREFFECT_H 121