1 /* 2 * Copyright (c) 2021-2022 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 ST_AUDIO_MANAGER_PROXY_H 17 #define ST_AUDIO_MANAGER_PROXY_H 18 19 #include "iremote_proxy.h" 20 #include "audio_system_manager.h" 21 #include "audio_manager_base.h" 22 23 namespace OHOS { 24 namespace AudioStandard { 25 class AudioManagerProxy : public IRemoteProxy<IStandardAudioService> { 26 public: 27 explicit AudioManagerProxy(const sptr<IRemoteObject> &impl); 28 virtual ~AudioManagerProxy() = default; 29 30 int32_t SetMicrophoneMute(bool isMute) override; 31 int32_t SetVoiceVolume(float volume) override; 32 int32_t GetCapturePresentationPosition(const std::string& deviceClass, uint64_t& frames, int64_t& timeSec, 33 int64_t& timeNanoSec) override; 34 int32_t GetRenderPresentationPosition(const std::string& deviceClass, uint64_t& frames, int64_t& timeSec, 35 int64_t& timeNanoSec) override; 36 int32_t OffloadSetVolume(float volume) override; 37 int32_t OffloadDrain() override; 38 int32_t OffloadGetPresentationPosition(uint64_t& frames, int64_t& timeSec, int64_t& timeNanoSec) override; 39 int32_t OffloadSetBufferSize(uint32_t sizeMs) override; 40 int32_t SetAudioScene(AudioScene audioScene, DeviceType activeDevice) override; 41 const std::string GetAudioParameter(const std::string &key) override; 42 const std::string GetAudioParameter(const std::string& networkId, const AudioParamKey key, 43 const std::string& condition) override; 44 const std::vector<std::pair<std::string, std::string>> GetExtraParameters(const std::string &mainKey, 45 const std::vector<std::string> &subKeys) override; 46 void SetAudioParameter(const std::string &key, const std::string &value) override; 47 void SetAudioParameter(const std::string& networkId, const AudioParamKey key, const std::string& condition, 48 const std::string& value) override; 49 void SetExtraParameters(const std::string &key, 50 const std::vector<std::pair<std::string, std::string>> &kvpairs) override; 51 int32_t UpdateActiveDeviceRoute(DeviceType type, DeviceFlag flag) override; 52 uint64_t GetTransactionId(DeviceType deviceType, DeviceRole deviceRole) override; 53 void NotifyDeviceInfo(std::string networkId, bool connected) override; 54 int32_t CheckRemoteDeviceState(std::string networkId, DeviceRole deviceRole, bool isStartDevice) override; 55 int32_t SetParameterCallback(const sptr<IRemoteObject>& object) override; 56 int32_t SetWakeupSourceCallback(const sptr<IRemoteObject>& object) override; 57 void SetAudioMonoState(bool audioMono) override; 58 void SetAudioBalanceValue(float audioBalance) override; 59 sptr<IRemoteObject> CreateAudioProcess(const AudioProcessConfig &config) override; 60 bool LoadAudioEffectLibraries(const std::vector<Library> libraries, const std::vector<Effect> effects, 61 std::vector<Effect> &successEffects) override; 62 void RequestThreadPriority(uint32_t tid, std::string bundleName) override; 63 bool CreateEffectChainManager(std::vector<EffectChain> &effectChains, 64 std::unordered_map<std::string, std::string> &map) override; 65 bool SetOutputDeviceSink(int32_t deviceType, std::string &sinkName) override; 66 bool CreatePlaybackCapturerManager() override; 67 int32_t SetSupportStreamUsage(std::vector<int32_t> usage) override; 68 int32_t RegiestPolicyProvider(const sptr<IRemoteObject> &object) override; 69 int32_t SetCaptureSilentState(bool state) override; 70 int32_t UpdateSpatializationState(AudioSpatializationState spatializationState) override; 71 int32_t NotifyStreamVolumeChanged(AudioStreamType streamType, float volume) override; 72 private: 73 static inline BrokerDelegator<AudioManagerProxy> delegator_; 74 }; 75 } // namespace AudioStandard 76 } // namespace OHOS 77 #endif // ST_AUDIO_MANAGER_PROXY_H 78