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