xref: /aosp_15_r20/frameworks/av/media/libeffects/loudness/aidl/EffectLoudnessEnhancer.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1 /*
2  * Copyright (C) 2022 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 "LoudnessEnhancerContext.h"
23 
24 namespace aidl::android::hardware::audio::effect {
25 
26 class LoudnessEnhancerImpl final : public EffectImpl {
27   public:
28     static const std::string kEffectName;
29     static const Descriptor kDescriptor;
30     LoudnessEnhancerImpl() = default;
~LoudnessEnhancerImpl()31     ~LoudnessEnhancerImpl() { cleanUp(); }
32 
33     ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
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     IEffect::Status effectProcessImpl(float* in, float* out, int process)
39             REQUIRES(mImplMutex) override;
40     std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
41             REQUIRES(mImplMutex) override;
42     RetCode releaseContext() REQUIRES(mImplMutex) override;
43 
getEffectName()44     std::string getEffectName() override { return kEffectName; }
45 
46   private:
47     std::shared_ptr<LoudnessEnhancerContext> mContext GUARDED_BY(mImplMutex);
48     ndk::ScopedAStatus getParameterLoudnessEnhancer(const LoudnessEnhancer::Tag& tag,
49                                                     Parameter::Specific* specific)
50             REQUIRES(mImplMutex);
51 };
52 
53 }  // namespace aidl::android::hardware::audio::effect
54