1 /*
2  * Copyright (C) 2024 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 #include "core-mock/StreamOutMock.h"
18 #include "core-mock/StreamCommonMock.h"
19 
20 namespace aidl::android::hardware::audio::core {
21 
getStreamCommon(std::shared_ptr<IStreamCommon> * _aidl_return)22 ndk::ScopedAStatus StreamOutMock::getStreamCommon(std::shared_ptr<IStreamCommon>* _aidl_return) {
23     if (!mStreamCommon) {
24         mStreamCommon = ndk::SharedRefBase::make<StreamCommonMock>();
25     }
26     *_aidl_return = mStreamCommon;
27     return ndk::ScopedAStatus::ok();
28 }
29 
getHwVolume(std::vector<float> * _aidl_return)30 ndk::ScopedAStatus StreamOutMock::getHwVolume(std::vector<float>* _aidl_return) {
31     *_aidl_return = mHwVolume;
32     return ndk::ScopedAStatus::ok();
33 }
setHwVolume(const std::vector<float> & in_channelVolumes)34 ndk::ScopedAStatus StreamOutMock::setHwVolume(const std::vector<float>& in_channelVolumes) {
35     mHwVolume = in_channelVolumes;
36     return ndk::ScopedAStatus::ok();
37 }
getAudioDescriptionMixLevel(float * _aidl_return)38 ndk::ScopedAStatus StreamOutMock::getAudioDescriptionMixLevel(float* _aidl_return) {
39     *_aidl_return = mAudioDescriptionMixLeveldB;
40     return ndk::ScopedAStatus::ok();
41 }
setAudioDescriptionMixLevel(float in_leveldB)42 ndk::ScopedAStatus StreamOutMock::setAudioDescriptionMixLevel(float in_leveldB) {
43     mAudioDescriptionMixLeveldB = in_leveldB;
44     return ndk::ScopedAStatus::ok();
45 }
getDualMonoMode(AudioDualMonoMode * _aidl_return)46 ndk::ScopedAStatus StreamOutMock::getDualMonoMode(AudioDualMonoMode* _aidl_return) {
47     *_aidl_return = mDualMonoMode;
48     return ndk::ScopedAStatus::ok();
49 }
setDualMonoMode(AudioDualMonoMode in_mode)50 ndk::ScopedAStatus StreamOutMock::setDualMonoMode(AudioDualMonoMode in_mode) {
51     mDualMonoMode = in_mode;
52     return ndk::ScopedAStatus::ok();
53 }
getPlaybackRateParameters(AudioPlaybackRate * _aidl_return)54 ndk::ScopedAStatus StreamOutMock::getPlaybackRateParameters(AudioPlaybackRate* _aidl_return) {
55     *_aidl_return = mPlaybackRateParameters;
56     return ndk::ScopedAStatus::ok();
57 }
setPlaybackRateParameters(const AudioPlaybackRate & in_playbackRate)58 ndk::ScopedAStatus StreamOutMock::setPlaybackRateParameters(
59         const AudioPlaybackRate& in_playbackRate) {
60     mPlaybackRateParameters = in_playbackRate;
61     return ndk::ScopedAStatus::ok();
62 }
63 
64 }  // namespace aidl::android::hardware::audio::core
65