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