1 /* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OHOS_AUDIO_RENDER_INTERFACE_IMPL_BASE_H 17 #define OHOS_AUDIO_RENDER_INTERFACE_IMPL_BASE_H 18 19 #include <mutex> 20 #include <string> 21 #include <cmath> 22 23 #include <v1_0/audio_types.h> 24 #include <v1_0/iaudio_render.h> 25 #include <v2_0/id_audio_manager.h> 26 27 namespace OHOS { 28 namespace HDI { 29 namespace DistributedAudio { 30 namespace Audio { 31 namespace V1_0 { 32 using OHOS::HDI::DistributedAudio::Audioext::V2_0::AudioData; 33 using OHOS::HDI::DistributedAudio::Audioext::V2_0::AudioParameter; 34 using OHOS::HDI::DistributedAudio::Audioext::V2_0::IDAudioCallback; 35 typedef enum { 36 RENDER_STATUS_OPEN = 0, 37 RENDER_STATUS_CLOSE, 38 RENDER_STATUS_START, 39 RENDER_STATUS_STOP, 40 RENDER_STATUS_PAUSE, 41 } AudioRenderStatus; 42 43 class AudioRenderInterfaceImplBase : public IAudioRender { 44 public: 45 AudioRenderInterfaceImplBase() = default; 46 virtual ~AudioRenderInterfaceImplBase() = default; 47 48 virtual const AudioDeviceDescriptor &GetRenderDesc() = 0; 49 virtual void SetVolumeInner(const uint32_t vol) = 0; 50 virtual void SetVolumeRangeInner(const uint32_t volMax, const uint32_t volMin) = 0; 51 virtual uint32_t GetVolumeInner() = 0; 52 virtual uint32_t GetMaxVolumeInner() = 0; 53 virtual uint32_t GetMinVolumeInner() = 0; 54 virtual void SetAttrs(const std::string &adpName, const AudioDeviceDescriptor &desc, 55 const AudioSampleAttributes &attrs, const sptr<IDAudioCallback> &callback, const int32_t dhId) = 0; 56 virtual void SetDumpFlagInner() = 0; 57 }; 58 } // V1_0 59 } // Audio 60 } // Distributedaudio 61 } // HDI 62 } // OHOS 63 #endif // OHOS_AUDIO_RENDER_INTERFACE_IMPL_BASE_H 64