1/* 2 * Copyright (c) 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 * 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 2.0 29 */ 30 31package ohos.hdi.audio.v2_0; 32 33import ohos.hdi.audio.v2_0.AudioTypes; 34 35/** 36 * @brief Called when an event defined in {@link AudioCallbackType} occurs. 37 * 38 * @param AudioCallbackType Indicates the occurred event that triggers this callback. 39 * @param reserved Indicates the pointer to a reserved field. 40 * @param cookie Indicates the pointer to the cookie for data transmission. 41 * @return Returns <b>0</b> if the callback is successfully executed; returns a negative value otherwise. 42 * @see RegCallback 43 */ 44[callback] interface IAudioCallback { 45/** 46 * @brief Called when an event defined in {@link AudioCallbackType} occurs. 47 * 48 * @param AudioCallbackType Indicates the occurred event that triggers this callback. 49 * @param reserved Indicates the pointer to a reserved field. 50 * @param cookie Indicates the pointer to the cookie for data transmission. 51 * @return Returns <b>0</b> if the callback is successfully executed; returns a negative value otherwise. 52 * @see RegCallback 53 */ 54 RenderCallback([in] enum AudioCallbackType type, [out] byte reserved, [out] byte cookie); 55 56/** 57 * @brief Register audio extra param callback that will be invoked during audio param event. 58 * 59 * @param key Indicates param change event. 60 * @param condition Indicates the param condition. 61 * @param value Indicates the param value. 62 * @param reserved Indicates reserved param. 63 * @param cookie Indicates the pointer to the callback parameters; 64 * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 65 */ 66 ParamCallback([in] enum AudioExtParamKey key, [in] String condition, [in] String value, [out] byte reserved, [in] byte cookie); 67} 68