blob: d094c69970dc5f6d1967e174876f68bae3f5e0c3 [file] [log] [blame]
Shunkai Yao725af212023-01-05 23:01:40 +00001/*
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"
Shunkai Yao725af212023-01-05 23:01:40 +000022#include "DynamicsProcessingContext.h"
23
24namespace aidl::android::hardware::audio::effect {
25
26class DynamicsProcessingImpl final : public EffectImpl {
27 public:
28 static const std::string kEffectName;
29 static const Descriptor kDescriptor;
Shunkai Yao6b857c92023-02-13 17:44:52 +000030 static const Capability kCapability;
Shunkai Yao725af212023-01-05 23:01:40 +000031
32 DynamicsProcessingImpl() { LOG(DEBUG) << __func__; }
33 ~DynamicsProcessingImpl() {
34 cleanUp();
35 LOG(DEBUG) << __func__;
36 }
37
38 ndk::ScopedAStatus open(const Parameter::Common& common,
39 const std::optional<Parameter::Specific>& specific,
40 OpenEffectReturn* ret) override;
41 ndk::ScopedAStatus commandImpl(CommandId command) override;
42 ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
43 ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
44 ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
45 Parameter::Specific* specific) override;
46 IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
47 std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
48 RetCode releaseContext() override;
49
50 std::shared_ptr<EffectContext> getContext() override { return mContext; }
51 std::string getEffectName() override { return kEffectName; }
52
53 private:
Shunkai Yao6b857c92023-02-13 17:44:52 +000054 static const DynamicsProcessing::EqBandConfig kEqBandConfigMin;
55 static const DynamicsProcessing::EqBandConfig kEqBandConfigMax;
56 static const Range::DynamicsProcessingRange kPreEqBandRange;
57 static const Range::DynamicsProcessingRange kPostEqBandRange;
58 static const Range kRange;
Shunkai Yao725af212023-01-05 23:01:40 +000059 std::shared_ptr<DynamicsProcessingContext> mContext;
60 ndk::ScopedAStatus getParameterDynamicsProcessing(const DynamicsProcessing::Tag& tag,
61 Parameter::Specific* specific);
62};
63
64} // namespace aidl::android::hardware::audio::effect