blob: 4897888f1bd37fbd61c6b5b78abb446cb53622f5 [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;
Shunkai Yao1afb46c2024-01-09 20:40:45 +000042 ndk::ScopedAStatus commandImpl(CommandId command) REQUIRES(mImplMutex) override;
Shunkai Yao725af212023-01-05 23:01:40 +000043 ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
Shunkai Yao1afb46c2024-01-09 20:40:45 +000044 ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
45 REQUIRES(mImplMutex) override;
46 ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
47 REQUIRES(mImplMutex) override;
48 IEffect::Status effectProcessImpl(float* in, float* out, int process)
49 REQUIRES(mImplMutex) override;
50 std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
51 REQUIRES(mImplMutex) override;
52 RetCode releaseContext() REQUIRES(mImplMutex) override;
Shunkai Yao725af212023-01-05 23:01:40 +000053
Shunkai Yao725af212023-01-05 23:01:40 +000054 std::string getEffectName() override { return kEffectName; }
55
56 private:
Shunkai Yao1afb46c2024-01-09 20:40:45 +000057 std::shared_ptr<DynamicsProcessingContext> mContext GUARDED_BY(mImplMutex);
Shunkai Yao725af212023-01-05 23:01:40 +000058 ndk::ScopedAStatus getParameterDynamicsProcessing(const DynamicsProcessing::Tag& tag,
Shunkai Yao1afb46c2024-01-09 20:40:45 +000059 Parameter::Specific* specific)
60 REQUIRES(mImplMutex);
Ram Mohanc89817d2023-03-14 21:39:26 +053061 bool isParamInRange(const Parameter::Specific& specific);
Shunkai Yao725af212023-01-05 23:01:40 +000062};
63
64} // namespace aidl::android::hardware::audio::effect