1 /* 2 * Copyright (c) 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 AUDIO_ENHANCE_CHAIN_MANAGER_H 17 #define AUDIO_ENHANCE_CHAIN_MANAGER_H 18 19 #include <cstdint> 20 21 #include "audio_effect.h" 22 #include "audio_effect_common.h" 23 24 namespace OHOS { 25 namespace AudioStandard { 26 class AudioEnhanceChainManager { 27 public: 28 static AudioEnhanceChainManager *GetInstance(); 29 30 virtual ~AudioEnhanceChainManager() = default; 31 32 virtual void InitAudioEnhanceChainManager(const std::vector<EffectChain> &enhanceChains, 33 const EffectChainManagerParam &managerParam, 34 const std::vector<std::shared_ptr<AudioEffectLibEntry>> &libList) = 0; 35 36 virtual int32_t CreateAudioEnhanceChainDynamic(uint64_t sceneKeyCode, const AudioEnhanceDeviceAttr &deviceAttr) = 0; 37 38 virtual int32_t ReleaseAudioEnhanceChainDynamic(uint64_t sceneKeyCode) = 0; 39 40 virtual int32_t AudioEnhanceChainGetAlgoConfig(uint64_t sceneKeyCode, AudioBufferConfig &micConfig, 41 AudioBufferConfig &ecConfig, AudioBufferConfig &micRefConfig) = 0; 42 43 virtual int32_t ApplyEnhanceChainById(uint64_t sceneKeyCode, const EnhanceTransBuffer &transBuf) = 0; 44 45 virtual int32_t GetChainOutputDataById(uint64_t sceneKeyCode, void *buf, size_t bufSize) = 0; 46 47 virtual int32_t SetInputDevice(uint32_t captureId, DeviceType inputDevice, const std::string &deviceName = "") = 0; 48 49 virtual int32_t SetOutputDevice(uint32_t renderId, DeviceType outputDevice) = 0; 50 51 virtual int32_t SetVolumeInfo(AudioVolumeType volumeType, float systemVol) = 0; 52 53 virtual int32_t SetMicrophoneMuteInfo(bool isMute) = 0; 54 55 virtual int32_t SetStreamVolumeInfo(uint32_t sessionId, float streamVol) = 0; 56 57 virtual int32_t SetAudioEnhanceProperty(const AudioEffectPropertyArrayV3 &propertyArray, 58 DeviceType deviceType = DEVICE_TYPE_NONE) = 0; 59 60 virtual int32_t GetAudioEnhanceProperty(AudioEffectPropertyArrayV3 &propertyArray, 61 DeviceType deviceType = DEVICE_TYPE_NONE) = 0; 62 63 virtual int32_t SetAudioEnhanceProperty(const AudioEnhancePropertyArray &propertyArray, 64 DeviceType deviceType = DEVICE_TYPE_NONE) = 0; 65 66 virtual int32_t GetAudioEnhanceProperty(AudioEnhancePropertyArray &propertyArray, 67 DeviceType deviceType = DEVICE_TYPE_NONE) = 0; 68 69 virtual void ResetInfo() = 0; 70 71 virtual void UpdateExtraSceneType(const std::string &mainkey, const std::string &subkey, 72 const std::string &extraSceneType) = 0; 73 74 virtual int32_t SendInitCommand() = 0; 75 }; 76 } // namespace AudioStandard 77 } // namespace OHOS 78 79 #endif // AUDIO_ENHANCE_CHAIN_MANAGER_H 80