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