blob: b48c85edb687da360071ad8e246307509d51deaa [file] [log] [blame]
Shunkai Yao05b190a2022-12-22 00:21:31 +00001/*
2 * Copyright (C) 2022 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 Yao05b190a2022-12-22 00:21:31 +000022
23#include "VisualizerContext.h"
24
25namespace aidl::android::hardware::audio::effect {
26
27class VisualizerImpl final : public EffectImpl {
28 public:
29 static const std::string kEffectName;
Shunkai Yao6b857c92023-02-13 17:44:52 +000030 static const Capability kCapability;
Shunkai Yao05b190a2022-12-22 00:21:31 +000031 static const Descriptor kDescriptor;
32 VisualizerImpl() { LOG(DEBUG) << __func__; }
33 ~VisualizerImpl() {
34 cleanUp();
35 LOG(DEBUG) << __func__;
36 }
37
Shunkai Yao1afb46c2024-01-09 20:40:45 +000038 ndk::ScopedAStatus commandImpl(CommandId command) REQUIRES(mImplMutex) override;
Shunkai Yao05b190a2022-12-22 00:21:31 +000039 ndk::ScopedAStatus getDescriptor(Descriptor* _aidl_return) override;
Shunkai Yao1afb46c2024-01-09 20:40:45 +000040 ndk::ScopedAStatus setParameterSpecific(const Parameter::Specific& specific)
41 REQUIRES(mImplMutex) override;
42 ndk::ScopedAStatus getParameterSpecific(const Parameter::Id& id, Parameter::Specific* specific)
43 REQUIRES(mImplMutex) override;
44 IEffect::Status effectProcessImpl(float* in, float* out, int process)
45 REQUIRES(mImplMutex) override;
46 std::shared_ptr<EffectContext> createContext(const Parameter::Common& common)
47 REQUIRES(mImplMutex) override;
48 RetCode releaseContext() REQUIRES(mImplMutex) override;
Shunkai Yao05b190a2022-12-22 00:21:31 +000049
Shunkai Yao05b190a2022-12-22 00:21:31 +000050 std::string getEffectName() override { return kEffectName; }
51
52 private:
Shunkai Yao6b857c92023-02-13 17:44:52 +000053 static const std::vector<Range::VisualizerRange> kRanges;
Shunkai Yao1afb46c2024-01-09 20:40:45 +000054 std::shared_ptr<VisualizerContext> mContext GUARDED_BY(mImplMutex);
Shunkai Yao05b190a2022-12-22 00:21:31 +000055 ndk::ScopedAStatus getParameterVisualizer(const Visualizer::Tag& tag,
Shunkai Yao1afb46c2024-01-09 20:40:45 +000056 Parameter::Specific* specific) REQUIRES(mImplMutex);
Shunkai Yao05b190a2022-12-22 00:21:31 +000057};
58
59} // namespace aidl::android::hardware::audio::effect