blob: 824ebea16c746c394fa7b023bada896d0072763b [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"
22#include "effect-impl/EffectUUID.h"
23#include "DynamicsProcessingContext.h"
24
25namespace aidl::android::hardware::audio::effect {
26
27class DynamicsProcessingImpl final : public EffectImpl {
28 public:
29 static const std::string kEffectName;
30 static const Descriptor kDescriptor;
31 static const DynamicsProcessing::Capability kCapability;
32
33 DynamicsProcessingImpl() { LOG(DEBUG) << __func__; }
34 ~DynamicsProcessingImpl() {
35 cleanUp();
36 LOG(DEBUG) << __func__;
37 }
38
39 ndk::ScopedAStatus open(const Parameter::Common& common,
40 const std::optional<Parameter::Specific>& specific,
41 OpenEffectReturn* ret) override;
42 ndk::ScopedAStatus commandImpl(CommandId command) override;
43 ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
44 ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific) override;
45 ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id,
46 Parameter::Specific* specific) override;
47 IEffect::Status effectProcessImpl(float* in, float* out, int process) override;
48 std::shared_ptr<EffectContext> createContext(const Parameter::Common& common) override;
49 RetCode releaseContext() override;
50
51 std::shared_ptr<EffectContext> getContext() override { return mContext; }
52 std::string getEffectName() override { return kEffectName; }
53
54 private:
55 std::shared_ptr<DynamicsProcessingContext> mContext;
56 ndk::ScopedAStatus getParameterDynamicsProcessing(const DynamicsProcessing::Tag& tag,
57 Parameter::Specific* specific);
58};
59
60} // namespace aidl::android::hardware::audio::effect