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