1/* 2 * Copyright (c) 2022-2023 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/** 17 * @addtogroup HdiAudio 18 * 19 * @brief Provides unified APIs for audio services to access audio drivers. 20 * 21 * An audio service can obtain an audio driver object or agent and then call APIs provided by this object or agent to 22 * access different types of audio devices based on the audio IDs, thereby obtaining audio information, 23 * subscribing to or unsubscribing from audio data, enabling or disabling an audio, 24 * setting the audio data reporting mode, and setting audio options such as the accuracy and measurement range. 25 * 26 * @since 4.0 27 * @version 1.0 28 */ 29 30package ohos.hdi.audio.v1_0; 31 32import ohos.hdi.audio.v1_0.AudioTypes; 33import ohos.hdi.audio.v1_0.IAudioAdapter; 34 35/** 36 * @brief Manages audio adapters through a specific adapter driver program loaded based on the given audio 37 * adapter descriptor. 38 * 39 * @see IAudioAdapter 40 * @since 4.0 41 * @version 1.0 42 */ 43interface IAudioManager { 44 /** 45 * @brief Obtains the list of all adapters supported by an audio driver. 46 * 47 * @param manager Indicates the pointer to the audio adapter manager to operate. 48 * @param descs Indicates the double pointer to the audio adapter list. 49 * @param size Indicates the pointer to the length of the list. 50 * @return Returns <b>0</b> if the list is obtained successfully; returns a negative value otherwise. 51 * @see LoadAdapter 52 */ 53 GetAllAdapters([out] struct AudioAdapterDescriptor[] descs); 54 55 /** 56 * @brief Loads the driver for an audio adapter. 57 * 58 * For example, to load a USB driver, you may need to load a dynamic-link library (*.so) in specific implementation. 59 * 60 * @param manager Indicates the pointer to the audio adapter manager to operate. 61 * @param desc Indicates the pointer to the descriptor of the audio adapter. 62 * @param adapter Indicates the double pointer to the audio adapter. 63 * @return Returns <b>0</b> if the driver is loaded successfully; returns a negative value otherwise. 64 * @see GetAllAdapters 65 * @see UnloadAdapter 66 */ 67 LoadAdapter([in] struct AudioAdapterDescriptor desc, [out] IAudioAdapter adapter); 68 69 /** 70 * @brief Unloads the driver of an audio adapter. 71 * 72 * @param manager Indicates the pointer to the audio adapter manager to operate. 73 * @param adapter Indicates the pointer to the audio adapter whose driver will be unloaded. 74 * @see LoadAdapter 75 */ 76 UnloadAdapter([in] String adapterName); 77 78 /** 79 * @brief Release the IAudioManager Object. 80 * 81 * @param object Indicates the pointer to the audio adapter manager to operate. 82 * @return Returns <b>true</b> if the Object is released; returns <b>false</b> otherwise. 83 */ 84 ReleaseAudioManagerObject(); 85} 86