diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 0704102f7a0e3608e56ea10d6015552fcc0c3a68..9b5a1cf08940415f5beb0a27ced493ec2169e59f 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -66,6 +66,24 @@ declare namespace audio { */ function createAudioRenderer(options: AudioRendererOptions): Promise; + /** + * Obtains a TonePlayer instance. This method uses an asynchronous callback to return the renderer instance. + * @param options Tone playing attribute. + * @return Promise used to return the tone player instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback): void; + + /** + * Obtains a TonePlayer instance. This method uses a promise to return the renderer instance. + * @param options Tone playing attribute. + * @return Promise used to return the tone player instance. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + function createTonePlayer(options: AudioRendererInfo): Promise; + /** * Enumerates the audio states. * @since 8 @@ -1841,6 +1859,259 @@ declare namespace audio { */ on(type: "stateChange", callback: Callback): void; } + + /** + * Enumerates tone types for player. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + enum ToneType { + /** + * Dial tone for key 0. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_0 = 0, + /** + * Dial tone for key 1. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_1 = 1, + /** + * Dial tone for key 2. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_2 = 2, + /** + * Dial tone for key 3. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_3 = 3, + /** + * Dial tone for key 4. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_4 = 4, + /** + * Dial tone for key 5. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_5 = 5, + /** + * Dial tone for key 6. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_6 = 6, + /** + * Dial tone for key 7. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_7 = 7, + /** + * Dial tone for key 8. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_8 = 8, + /** + * Dial tone for key 9. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_9 = 9, + /** + * Dial tone for key *. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_S = 10, + /** + * Dial tone for key #. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_P = 11, + /** + * Dial tone for key A. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_A = 12, + /** + * Dial tone for key B. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_B = 13, + /** + * Dial tone for key C. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_C = 14, + /** + * Dial tone for key D. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_DIAL_D = 15, + + /** + * Supervisory tone for dial. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_DIAL = 100, + /** + * Supervisory tone for busy. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_BUSY = 101, + /** + * Supervisory tone for dial. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_CONGESTION = 102, + /** + * Supervisory tone for radio path acknowlegment. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK = 103, + /** + * Supervisory tone for radio path not available. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE = 104, + /** + * Supervisory tone for error. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_ERROR = 105, + /** + * Supervisory tone for call waiting. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING = 106, + /** + * Supervisory tone for ringtone. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_SUPERVISORY_RINGTONE = 107, + + /** + * Proprietary tone for beep. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_PROPRIETARY_BEEP = 200, + /** + * Proprietary tone for positive acknowlegment. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_PROPRIETARY_ACK = 201, + /** + * Proprietary tone for negative acknowlegment. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_PROPRIETARY_NACK = 202, + /** + * Proprietary tone for prompt. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_PROPRIETARY_PROMPT = 203, + /** + * Proprietary tone for double beep. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP = 204, + } + + /** + * Provides APIs for tone playing. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + interface TonePlayer { + /** + * Starts player. This method uses an asynchronous callback to return the result. + * @param type Tone type to play. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + load(type: ToneType, callback: AsyncCallback): void; + /** + * Starts tplayerone. This method uses a promise to return the result. + * @param type Tone type to play. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + load(type: ToneType): Promise; + + /** + * Starts player. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + start(callback: AsyncCallback): void; + /** + * Starts player. This method uses a promise to return the result. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + start(): Promise; + + /** + * Stops player. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + stop(callback: AsyncCallback): void; + /** + * Stops player. This method uses a promise to return the result. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + stop(): Promise; + + /** + * Releases the player. This method uses an asynchronous callback to return the result. + * @param callback Callback used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + release(callback: AsyncCallback): void; + /** + * Releases the player. This method uses a promise to return the result. + * @return Promise used to return the result. + * @since 9 + * @syscap SystemCapability.Multimedia.Audio.Tone + */ + release(): Promise; + } } export default audio;