• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 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 #define LOG_TAG "EffectsFactory7.0"
18 #include <log/log.h>
19 
20 #include "LoudnessEnhancerEffect.h"
21 
22 using ::android::hardware::hidl_string;
23 using ::android::hardware::hidl_vec;
24 using ::android::hardware::Return;
25 using ::android::hardware::Void;
26 using namespace ::android::hardware::audio::common::V7_0;
27 
28 namespace android::hardware::audio::effect::V7_0::implementation {
29 
getDescriptor()30 const EffectDescriptor& LoudnessEnhancerEffect::getDescriptor() {
31     // Note: for VTS tests only 'type' and 'uuid' fields are required.
32     // The actual implementation must provide meaningful values
33     // for all fields of the descriptor.
34     static const EffectDescriptor descriptor = {
35             .type =
36                     {// Same UUID as AudioEffect.EFFECT_TYPE_LOUDNESS_ENHANCER in Java.
37                      0xfe3199be, 0xaed0, 0x413f, 0x87bb,
38                      std::array<uint8_t, 6>{{0x11, 0x26, 0x0e, 0xb6, 0x3c, 0xf1}}},
39             .uuid = {0, 0, 0, 2, std::array<uint8_t, 6>{{0, 0, 0, 0, 0, 0}}}};
40     return descriptor;
41 }  // namespace android::hardware::audio::effect::V7_0::implementation
42 
LoudnessEnhancerEffect()43 LoudnessEnhancerEffect::LoudnessEnhancerEffect() : mEffect(new Effect(getDescriptor())) {}
44 
setTargetGain(int32_t targetGainMb)45 Return<Result> LoudnessEnhancerEffect::setTargetGain(int32_t targetGainMb) {
46     mTargetGainMb = targetGainMb;
47     return Result::OK;
48 }
49 
getTargetGain(getTargetGain_cb _hidl_cb)50 Return<void> LoudnessEnhancerEffect::getTargetGain(getTargetGain_cb _hidl_cb) {
51     _hidl_cb(Result::OK, mTargetGainMb);
52     return Void();
53 }
54 
55 }  // namespace android::hardware::audio::effect::V7_0::implementation
56