From 15b2f7d17dfe1a1500b083793186f1abdce800ef Mon Sep 17 00:00:00 2001 From: magekkkk Date: Thu, 14 Jul 2022 20:46:46 +0800 Subject: [PATCH] add more extend api in audio for new features Signed-off-by: magekkkk --- api/@ohos.multimedia.audio.d.ts | 96 ++++++++++++++++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index bdb1d01c64..cc4396f201 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -1387,6 +1387,74 @@ declare namespace audio { off(type: "audioCapturerChange"); } + /** + * Implements audio router management. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Device + * @systemapi + */ + interface AudioRoutingManager { + /** + * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive + * the callback. + * @param deviceFlag Audio device flag. + * @param callback Callback used to obtain the device update details. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Device + */ + on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void; + + /** + * Listens for system microphone state change events. This method uses a callback to get microphone change events. + * @param callback Callback used to get the system microphone state change event. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Device + */ + on(type: 'micStateChange', callback: Callback): void; + } + + /** + * Describes the microphone state change event received by the app when the microphone state is changed. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Device + */ + interface MicStateChangeEvent { + /** + * Mic mute state. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Device + */ + mute: boolean; + } + + /** + * Implements audio communication management. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + */ + interface AudioCommunicationManager { + /** + * Sets the ringer mode. This method uses an asynchronous callback to return the result. + * @param mode Ringer mode. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi + */ + setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; + /** + * Sets the ringer mode. This method uses a promise to return the result. + * @param mode Ringer mode. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Communication + * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY + * @systemapi + */ + setRingerMode(mode: AudioRingMode): Promise; + } + /** * Array of AudioRendererChangeInfo, which is read-only. * @since 9 @@ -1889,7 +1957,7 @@ declare namespace audio { * @since 9 * @syscap SystemCapability.Multimedia.Audio.Renderer */ - on(type: 'interrupt', callback: Callback): void; + on(type: 'audioInterrupt', callback: Callback): void; /** * Subscribes to mark reached events. When the number of frames rendered reaches the value of the frame parameter, * the callback is invoked. @@ -1929,6 +1997,32 @@ declare namespace audio { on(type: "stateChange", callback: Callback): void; } + /** + * Describe data info. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + interface AudioRendererDataInfo { + /** + * Buffer to fill. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + buffer: ArrayBuffer; + /** + * Data written length. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + dataLength: number; + /** + * Extend info with buffer. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Renderer + */ + bufferFlags: number; + } + /** * Enumerates source types. * @since 8 -- Gitee