blob: 1e1e72e727fb7b3c8cdef21f0f47733d37dc03d4 [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
Shunkai Yao725af212023-01-05 23:01:40 +000021#include "DynamicsProcessingContext.h"
Ram Mohanc89817d2023-03-14 21:39:26 +053022#include "EffectRangeSpecific.h"
23#include "effect-impl/EffectImpl.h"
Shunkai Yao725af212023-01-05 23:01:40 +000024
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;
Shunkai Yao6b857c92023-02-13 17:44:52 +000031 static const Capability kCapability;
Shunkai Yao725af212023-01-05 23:01:40 +000032
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:
Shunkai Yao725af212023-01-05 23:01:40 +000055 std::shared_ptr<DynamicsProcessingContext> mContext;
56 ndk::ScopedAStatus getParameterDynamicsProcessing(const DynamicsProcessing::Tag& tag,
57 Parameter::Specific* specific);
Ram Mohanc89817d2023-03-14 21:39:26 +053058 bool isParamInRange(const Parameter::Specific& specific);
Shunkai Yao725af212023-01-05 23:01:40 +000059};
60
61} // namespace aidl::android::hardware::audio::effect