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