blob: 9ce55976c982be2da6a254ef0b888295718c4855 [file] [log] [blame]
Shraddha Basantwanice054522023-01-20 23:36:54 +05301/*
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 "PreProcessingContext.h"
22#include "PreProcessingSession.h"
23#include "effect-impl/EffectImpl.h"
24
25namespace aidl::android::hardware::audio::effect {
26
27class EffectPreProcessing final : public EffectImpl {
28 public:
29 explicit EffectPreProcessing(const AudioUuid& uuid);
30 ~EffectPreProcessing() override;
31
32 ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
33
Shunkai Yao1afb46c2024-01-09 20:40:45 +000034 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;
Shraddha Basantwanice054522023-01-20 23:36:54 +053038
Shunkai Yao1afb46c2024-01-09 20:40:45 +000039 std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
40 REQUIRES(mImplMutex) override;
41 RetCode releaseContext() REQUIRES(mImplMutex) override;
Shraddha Basantwanice054522023-01-20 23:36:54 +053042
Shunkai Yao1afb46c2024-01-09 20:40:45 +000043 IEffect::Status effectProcessImpl(float* in, float* out, int samples)
44 REQUIRES(mImplMutex) override;
Shraddha Basantwanice054522023-01-20 23:36:54 +053045
Shunkai Yao1afb46c2024-01-09 20:40:45 +000046 ndk::ScopedAStatus commandImpl(CommandId command) REQUIRES(mImplMutex) override;
Shraddha Basantwanice054522023-01-20 23:36:54 +053047
48 std::string getEffectName() override { return *mEffectName; }
49
50 private:
Shunkai Yao1afb46c2024-01-09 20:40:45 +000051 std::shared_ptr<PreProcessingContext> mContext GUARDED_BY(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053052 const Descriptor* mDescriptor;
53 const std::string* mEffectName;
54 PreProcessingEffectType mType;
55
Shunkai Yao1afb46c2024-01-09 20:40:45 +000056 ndk::ScopedAStatus setParameterAcousticEchoCanceler(const Parameter::Specific& specific)
57 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053058 ndk::ScopedAStatus getParameterAcousticEchoCanceler(const AcousticEchoCanceler::Id& id,
Shunkai Yao1afb46c2024-01-09 20:40:45 +000059 Parameter::Specific* specific)
60 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053061
Shunkai Yao1afb46c2024-01-09 20:40:45 +000062 ndk::ScopedAStatus setParameterAutomaticGainControlV1(const Parameter::Specific& specific)
63 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053064 ndk::ScopedAStatus getParameterAutomaticGainControlV1(const AutomaticGainControlV1::Id& id,
Shunkai Yao1afb46c2024-01-09 20:40:45 +000065 Parameter::Specific* specific)
66 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053067
Shunkai Yao1afb46c2024-01-09 20:40:45 +000068 ndk::ScopedAStatus setParameterAutomaticGainControlV2(const Parameter::Specific& specific)
69 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053070 ndk::ScopedAStatus getParameterAutomaticGainControlV2(const AutomaticGainControlV2::Id& id,
Shunkai Yao1afb46c2024-01-09 20:40:45 +000071 Parameter::Specific* specific)
72 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053073
Shunkai Yao1afb46c2024-01-09 20:40:45 +000074 ndk::ScopedAStatus setParameterNoiseSuppression(const Parameter::Specific& specific)
75 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053076 ndk::ScopedAStatus getParameterNoiseSuppression(const NoiseSuppression::Id& id,
Shunkai Yao1afb46c2024-01-09 20:40:45 +000077 Parameter::Specific* specific)
78 REQUIRES(mImplMutex);
Shraddha Basantwanice054522023-01-20 23:36:54 +053079};
80
81} // namespace aidl::android::hardware::audio::effect