From a357a16d2a018f3e421bfcbf83b0cad80290a6e3 Mon Sep 17 00:00:00 2001 From: g00514389 Date: Fri, 21 Mar 2025 17:56:35 +0800 Subject: [PATCH 1/4] add new format Signed-off-by: g00514389 --- api/@ohos.multimedia.audio.d.ts | 83 ++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index e25e77e071..4bc81b41e2 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -100,6 +100,12 @@ declare namespace audio { * @since 9 */ ERROR_TIMEOUT = 6800105, + /** + * Unsupported audio format, such as unsupported encodingType, sampleFormat, sampleRate etc. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 19 + */ + ERROR_UNSUPPORTED_FORMAT = 6800106, /** * Audio specific errors. * @syscap SystemCapability.Multimedia.Audio.Core @@ -1405,7 +1411,13 @@ declare namespace audio { * @atomicservice * @since 12 */ - ENCODING_TYPE_RAW = 0 + ENCODING_TYPE_RAW = 0, + /** + * AC3 encoding. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 19 + */ + ENCODING_TYPE_AC3 = 2 } /** @@ -3044,6 +3056,32 @@ declare namespace audio { */ off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback): void; + /** + * Listens for render error events. This method uses a callback to get render error events. + * @param { 'renderError' } type - Type of the event to listen for. Only the render error event is supported. + * @param { Callback } callback - Callback used to listen for error callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 19 + */ + on(type: 'renderError', callback: Callback): void; + + /** + * Unsubscribes from render error events. + * @param { 'renderError' } type - Type of the event to listen for. Only the render error event is supported. + * @param { Callback } callback - Callback used to listen for error callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 19 + */ + off(type: 'renderError', callback: Callback): void; + /** * Obtains an {@link AudioVolumeManager} instance. * @returns { AudioVolumeManager } AudioVolumeManager instance. @@ -4302,6 +4340,20 @@ declare namespace audio { * @since 12 */ isActiveSync(volumeType: AudioVolumeType): boolean; + + /** + * Returns the mode of direct playback available for a given audio format with current active device. + * @param { AudioStreamInfo } streamInfo - the stream information + * @param { StreamUsage } streamUsage - the stream usage + * @returns { DirectPlaybackMode } The direct playback mode. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 6800101 - Parameter verification failed. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @since 19 + */ + getDirectPlaybackSupport(streamInfo: AudioStreamInfo, streamUsage: StreamUsage): DirectPlaybackMode; } /** @@ -10798,6 +10850,35 @@ declare namespace audio { */ flag: EffectFlag; } + + /** + * Enumerates direct playback modes. + * @enum { number } + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 19 + */ + enum DirectPlaybackMode{ + /** + * Direct playback is not supported. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 19 + */ + DIRECT_PLAYBACK_NOT_SUPPORTED = 0, + + /** + * Direct playback mode which is bitstream pass-through such as compressed pass-through. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 19 + */ + DIRECT_PLAYBACK_BITSTREAM_SUPPORTED = 1, + + /** + * Direct playback mode which is pcm pass-through, without any process such as resampling. + * @syscap SystemCapability.Multimedia.Audio.Core + * @since 19 + */ + DIRECT_PLAYBACK_PCM_SUPPORTED= 2 + } } export default audio; -- Gitee From bff9dc6fc9debd56d46fe37328e39a67d7915b1f Mon Sep 17 00:00:00 2001 From: g00514389 Date: Fri, 21 Mar 2025 18:15:08 +0800 Subject: [PATCH 2/4] change format Signed-off-by: g00514389 --- api/@ohos.multimedia.audio.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 4bc81b41e2..822c232aa9 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -1413,11 +1413,11 @@ declare namespace audio { */ ENCODING_TYPE_RAW = 0, /** - * AC3 encoding. + * E_AC3 encoding. * @syscap SystemCapability.Multimedia.Audio.Core * @since 19 */ - ENCODING_TYPE_AC3 = 2 + ENCODING_TYPE_E_AC3 = 2 } /** -- Gitee From fa6ecf910a1d7907aa06c5d63340c7d51a74db06 Mon Sep 17 00:00:00 2001 From: g00514389 Date: Tue, 25 Mar 2025 14:08:21 +0800 Subject: [PATCH 3/4] modify off api Signed-off-by: g00514389 --- api/@ohos.multimedia.audio.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 822c232aa9..7316af3422 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -3080,7 +3080,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 19 */ - off(type: 'renderError', callback: Callback): void; + off(type: 'renderError', callback?: Callback): void; /** * Obtains an {@link AudioVolumeManager} instance. -- Gitee From 954663ef658140e7ced92317576caeb4a31985b8 Mon Sep 17 00:00:00 2001 From: g00514389 Date: Thu, 17 Apr 2025 15:05:30 +0800 Subject: [PATCH 4/4] change typos Signed-off-by: g00514389 --- api/@ohos.multimedia.audio.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 7316af3422..8b86a02175 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -101,7 +101,7 @@ declare namespace audio { */ ERROR_TIMEOUT = 6800105, /** - * Unsupported audio format, such as unsupported encodingType, sampleFormat, sampleRate etc. + * Unsupported audio format, such as unsupported encoding type, sample format etc. * @syscap SystemCapability.Multimedia.Audio.Core * @since 19 */ @@ -3057,7 +3057,8 @@ declare namespace audio { off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback): void; /** - * Listens for render error events. This method uses a callback to get render error events. + * Subscribe for render error events. This method uses a callback to get render error events. + * For example, a render error event of "6800106" will be reported when the playing audio format is not supported anymore due to device change. * @param { 'renderError' } type - Type of the event to listen for. Only the render error event is supported. * @param { Callback } callback - Callback used to listen for error callback. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -3070,7 +3071,7 @@ declare namespace audio { on(type: 'renderError', callback: Callback): void; /** - * Unsubscribes from render error events. + * Unsubscribes for render error events. * @param { 'renderError' } type - Type of the event to listen for. Only the render error event is supported. * @param { Callback } callback - Callback used to listen for error callback. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -10857,7 +10858,7 @@ declare namespace audio { * @syscap SystemCapability.Multimedia.Audio.Core * @since 19 */ - enum DirectPlaybackMode{ + enum DirectPlaybackMode { /** * Direct playback is not supported. * @syscap SystemCapability.Multimedia.Audio.Core @@ -10873,11 +10874,11 @@ declare namespace audio { DIRECT_PLAYBACK_BITSTREAM_SUPPORTED = 1, /** - * Direct playback mode which is pcm pass-through, without any process such as resampling. + * Direct playback mode of pcm. * @syscap SystemCapability.Multimedia.Audio.Core * @since 19 */ - DIRECT_PLAYBACK_PCM_SUPPORTED= 2 + DIRECT_PLAYBACK_PCM_SUPPORTED = 2 } } -- Gitee