1 /* 2 * Copyright (C) 2023 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 <aidl/android/hardware/audio/effect/BnEffect.h> 20 21 #include "effect-impl/EffectImpl.h" 22 #include "ReverbContext.h" 23 24 namespace aidl::android::hardware::audio::effect { 25 26 class EffectReverb final : public EffectImpl { 27 public: 28 explicit EffectReverb(const AudioUuid& uuid); 29 ~EffectReverb() override; 30 31 ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; 32 33 ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override; 34 ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, 35 Parameter::Specific* specific) override; 36 37 std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override; 38 std::shared_ptr<EffectContext> getContext() override; 39 RetCode releaseContext() override; 40 41 IEffect::Status effectProcessImpl(float* in, float* out, int samples) override; 42 43 ndk::ScopedAStatus commandImpl(CommandId command) override; 44 getEffectName()45 std::string getEffectName() override { return *mEffectName; } 46 47 private: 48 std::shared_ptr<ReverbContext> mContext; 49 const Descriptor* mDescriptor; 50 const std::string* mEffectName; 51 lvm::ReverbEffectType mType; 52 53 IEffect::Status status(binder_status_t status, size_t consumed, size_t produced); 54 55 ndk::ScopedAStatus setParameterPresetReverb(const Parameter::Specific& specific); 56 ndk::ScopedAStatus getParameterPresetReverb(const PresetReverb::Id& id, 57 Parameter::Specific* specific); 58 59 ndk::ScopedAStatus setParameterEnvironmentalReverb(const Parameter::Specific& specific); 60 ndk::ScopedAStatus getParameterEnvironmentalReverb(const EnvironmentalReverb::Id& id, 61 Parameter::Specific* specific); 62 }; 63 64 } // namespace aidl::android::hardware::audio::effect 65