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 "PreProcessingContext.h" 22 #include "PreProcessingSession.h" 23 #include "effect-impl/EffectImpl.h" 24 25 namespace aidl::android::hardware::audio::effect { 26 27 class EffectPreProcessing final : public EffectImpl { 28 public: 29 explicit EffectPreProcessing(const AudioUuid& uuid); 30 ~EffectPreProcessing() override; 31 32 ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override; 33 34 ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) 35 REQUIRES(mImplMutex) override; 36 ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific) 37 REQUIRES(mImplMutex) override; 38 39 std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) 40 REQUIRES(mImplMutex) override; 41 RetCode releaseContext() REQUIRES(mImplMutex) override; 42 43 IEffect::Status effectProcessImpl(float* in, float* out, int samples) 44 REQUIRES(mImplMutex) override; 45 getEffectName()46 std::string getEffectName() override { return *mEffectName; } 47 48 private: 49 std::shared_ptr<PreProcessingContext> mContext GUARDED_BY(mImplMutex); 50 const Descriptor* mDescriptor; 51 const std::string* mEffectName; 52 PreProcessingEffectType mType; 53 54 ndk::ScopedAStatus setParameterAcousticEchoCanceler(const Parameter::Specific& specific) 55 REQUIRES(mImplMutex); 56 ndk::ScopedAStatus getParameterAcousticEchoCanceler(const AcousticEchoCanceler::Id& id, 57 Parameter::Specific* specific) 58 REQUIRES(mImplMutex); 59 60 ndk::ScopedAStatus setParameterAutomaticGainControlV1(const Parameter::Specific& specific) 61 REQUIRES(mImplMutex); 62 ndk::ScopedAStatus getParameterAutomaticGainControlV1(const AutomaticGainControlV1::Id& id, 63 Parameter::Specific* specific) 64 REQUIRES(mImplMutex); 65 66 ndk::ScopedAStatus setParameterAutomaticGainControlV2(const Parameter::Specific& specific) 67 REQUIRES(mImplMutex); 68 ndk::ScopedAStatus getParameterAutomaticGainControlV2(const AutomaticGainControlV2::Id& id, 69 Parameter::Specific* specific) 70 REQUIRES(mImplMutex); 71 72 ndk::ScopedAStatus setParameterNoiseSuppression(const Parameter::Specific& specific) 73 REQUIRES(mImplMutex); 74 ndk::ScopedAStatus getParameterNoiseSuppression(const NoiseSuppression::Id& id, 75 Parameter::Specific* specific) 76 REQUIRES(mImplMutex); 77 }; 78 79 } // namespace aidl::android::hardware::audio::effect 80