/* * Copyright (c) 2021-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @kit AudioKit */ import { ErrorCallback, AsyncCallback, Callback } from './@ohos.base'; /** * @namespace audio * @since 7 */ declare namespace audio { /** * Enumerates audio errors. * @enum {number} * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ enum AudioErrors { /** * Invalid parameter. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ ERROR_INVALID_PARAM = 6800101, /** * Allocate memory failed. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ ERROR_NO_MEMORY = 6800102, /** * Operation not permit at current state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ ERROR_ILLEGAL_STATE = 6800103, /** * Unsupported option. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ ERROR_UNSUPPORTED = 6800104, /** * Time out. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ ERROR_TIMEOUT = 6800105, /** * Audio specific errors. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ ERROR_STREAM_LIMIT = 6800201, /** * Default error. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ ERROR_SYSTEM = 6800301 } /** * Define local device network id for audio * @constant * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ const LOCAL_NETWORK_ID: string; /** * Define default volume group id for audio * @constant * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ const DEFAULT_VOLUME_GROUP_ID: number; /** * Define default interrupt group id for audio * @constant * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 9 */ const DEFAULT_INTERRUPT_GROUP_ID: number; /** * Obtains an {@link AudioManager} instance. * @returns { AudioManager } this {@link AudioManager} object. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 */ function getAudioManager(): AudioManager; /** * Obtains an {@link AudioCapturer} instance. This method uses an asynchronous callback to return the capturer instance. * @param { AudioCapturerOptions } options - Capturer configurations. * @param { AsyncCallback } callback - Callback used to return the audio capturer instance. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ function createAudioCapturer(options: AudioCapturerOptions, callback: AsyncCallback): void; /** * Obtains an {@link AudioCapturer} instance. This method uses a promise to return the capturer instance. * @param { AudioCapturerOptions } options - Capturer configurations. * @returns { Promise } Promise used to return the audio capturer instance. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ function createAudioCapturer(options: AudioCapturerOptions): Promise; /** * Obtains an {@link AudioRenderer} instance. This method uses an asynchronous callback to return the renderer instance. * @param { AudioRendererOptions } options - Renderer configurations. * @param { AsyncCallback } callback - Callback used to return the audio renderer instance. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ function createAudioRenderer(options: AudioRendererOptions, callback: AsyncCallback): void; /** * Obtains an {@link AudioRenderer} instance. This method uses a promise to return the renderer instance. * @param { AudioRendererOptions } options - Renderer configurations. * @returns { Promise } Promise used to return the audio renderer instance. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ function createAudioRenderer(options: AudioRendererOptions): Promise; /** * Obtains a {@link TonePlayer} instance. This method uses an asynchronous callback to return the renderer instance. * @param { AudioRendererInfo } options - Tone playing attribute. * @param { AsyncCallback } callback - Callback used to return the tonePlayer instance. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback): void; /** * Obtains a {@link TonePlayer} instance. This method uses a promise to return the renderer instance. * @param { AudioRendererInfo } options - Tone playing attribute. * @returns { Promise } Promise used to return the tonePlayer instance. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ function createTonePlayer(options: AudioRendererInfo): Promise; /** * Enumerates the audio states. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ enum AudioState { /** * Invalid state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ STATE_INVALID = -1, /** * Create new instance state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ STATE_NEW = 0, /** * Prepared state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ STATE_PREPARED = 1, /** * Running state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ STATE_RUNNING = 2, /** * Stopped state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ STATE_STOPPED = 3, /** * Released state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ STATE_RELEASED = 4, /** * Paused state. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ STATE_PAUSED = 5 } /** * Enumerates audio stream types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 */ enum AudioVolumeType { /** * Audio streams for voice calls. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 8 */ VOICE_CALL = 0, /** * Audio streams for ringtones. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 */ RINGTONE = 2, /** * Audio streams for media purpose. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 */ MEDIA = 3, /** * Audio volume for alarm purpose. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ ALARM = 4, /** * Audio volume for accessibility purpose. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ ACCESSIBILITY = 5, /** * Audio stream for voice assistant. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 8 */ VOICE_ASSISTANT = 9, /** * Audio volume for ultrasonic. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ ULTRASONIC = 10, /** * Audio stream for all common. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ ALL = 100, } /** * Enumerates audio device flags. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ enum DeviceFlag { /** * None devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ NONE_DEVICES_FLAG = 0, /** * Output devices. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ OUTPUT_DEVICES_FLAG = 1, /** * Input devices. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ INPUT_DEVICES_FLAG = 2, /** * All devices. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ ALL_DEVICES_FLAG = 3, /** * Distributed output devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ DISTRIBUTED_OUTPUT_DEVICES_FLAG = 4, /** * Distributed input devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ DISTRIBUTED_INPUT_DEVICES_FLAG = 8, /** * All Distributed devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ ALL_DISTRIBUTED_DEVICES_FLAG = 12, } /** * Enumerates audio device for usage. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ enum DeviceUsage { /** * Media output devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ MEDIA_OUTPUT_DEVICES = 1, /** * Media input devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ MEDIA_INPUT_DEVICES = 2, /** * All media devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ ALL_MEDIA_DEVICES = 3, /** * Call output devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ CALL_OUTPUT_DEVICES = 4, /** * Call input devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ CALL_INPUT_DEVICES = 8, /** * All call devices. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ ALL_CALL_DEVICES = 12, } /** * Enumerates device roles. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ enum DeviceRole { /** * Input role. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ INPUT_DEVICE = 1, /** * Output role. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ OUTPUT_DEVICE = 2, } /** * Enumerates device types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ enum DeviceType { /** * Invalid device. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ INVALID = 0, /** * Built-in earpiece. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ EARPIECE = 1, /** * Built-in speaker. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ SPEAKER = 2, /** * Wired headset, which is a combination of a pair of earpieces and a microphone. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ WIRED_HEADSET = 3, /** * A pair of wired headphones. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ WIRED_HEADPHONES = 4, /** * Bluetooth device using the synchronous connection oriented link (SCO). * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ BLUETOOTH_SCO = 7, /** * Bluetooth device using advanced audio distribution profile (A2DP). * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ BLUETOOTH_A2DP = 8, /** * Built-in microphone. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ MIC = 15, /** * USB audio headset. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ USB_HEADSET = 22, /** * Default device type. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ DEFAULT = 1000, } /** * Enumerates the active device types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.CommunicationDeviceType */ enum ActiveDeviceType { /** * Speaker. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.CommunicationDeviceType.SPEAKER */ SPEAKER = 2, /** * Bluetooth device using the SCO link. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 */ BLUETOOTH_SCO = 7, } /** * Enumerates the available device types for communication. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Communication * @since 9 */ enum CommunicationDeviceType { /** * Speaker. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 9 */ SPEAKER = 2 } /** * Enumerates ringer modes. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 */ enum AudioRingMode { /** * Silent mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 */ RINGER_MODE_SILENT = 0, /** * Vibration mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 */ RINGER_MODE_VIBRATE = 1, /** * Normal mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 */ RINGER_MODE_NORMAL = 2, } /** * Enumerates the audio sample formats. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ enum AudioSampleFormat { /** * Invalid format. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_FORMAT_INVALID = -1, /** * Unsigned 8 format. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_FORMAT_U8 = 0, /** * Signed 16 bit integer, little endian. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_FORMAT_S16LE = 1, /** * Signed 24 bit integer, little endian. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_FORMAT_S24LE = 2, /** * Signed 32 bit integer, little endian. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_FORMAT_S32LE = 3, /** * Signed 32 bit float, little endian. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ SAMPLE_FORMAT_F32LE = 4, } /** * Enumerates the audio channel. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ enum AudioChannel { /** * Channel 1. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ CHANNEL_1 = 0x1 << 0, /** * Channel 2. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ CHANNEL_2 = 0x1 << 1, /** * Channel 3. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_3 = 3, /** * Channel 4. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_4 = 4, /** * Channel 5. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_5 = 5, /** * Channel 6. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_6 = 6, /** * Channel 7. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_7 = 7, /** * Channel 8. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_8 = 8, /** * Channel 9. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_9 = 9, /** * Channel 10. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_10 = 10, /** * Channel 12. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_12 = 12, /** * Channel 14. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_14 = 14, /** * Channel 16. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CHANNEL_16 = 16 } /** * Enumerates the audio sampling rate. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ enum AudioSamplingRate { /** * 8kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_8000 = 8000, /** * 11.025kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_11025 = 11025, /** * 12kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_12000 = 12000, /** * 16kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_16000 = 16000, /** * 22.05kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_22050 = 22050, /** * 24kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_24000 = 24000, /** * 32kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_32000 = 32000, /** * 44.1kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_44100 = 44100, /** * 48kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_48000 = 48000, /** * 64kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_64000 = 64000, /** * 96kHz sample rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SAMPLE_RATE_96000 = 96000 } /** * Enumerates the audio encoding type. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ enum AudioEncodingType { /** * Invalid type. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ ENCODING_TYPE_INVALID = -1, /** * PCM encoding. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ ENCODING_TYPE_RAW = 0 } /** * Enumerates the audio content type. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage */ enum ContentType { /** * Unknown content. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_UNKNOWN */ CONTENT_TYPE_UNKNOWN = 0, /** * Speech content. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION */ CONTENT_TYPE_SPEECH = 1, /** * Music content. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC */ CONTENT_TYPE_MUSIC = 2, /** * Movie content. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE */ CONTENT_TYPE_MOVIE = 3, /** * Notification content. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_NOTIFICATION */ CONTENT_TYPE_SONIFICATION = 4, /** * Ringtone content. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE */ CONTENT_TYPE_RINGTONE = 5, } /** * Enumerates the stream usage. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 */ enum StreamUsage { /** * Unknown usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 */ STREAM_USAGE_UNKNOWN = 0, /** * Media usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MUSIC or * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_MOVIE or * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_GAME or * ohos.multimedia.audio.StreamUsage.STREAM_USAGE_AUDIOBOOK */ STREAM_USAGE_MEDIA = 1, /** * Music usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_MUSIC = 1, /** * Voice communication usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 */ STREAM_USAGE_VOICE_COMMUNICATION = 2, /** * Voice assistant broadcast usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ STREAM_USAGE_VOICE_ASSISTANT = 3, /** * Alarm usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_ALARM = 4, /** * Voice message usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_VOICE_MESSAGE = 5, /** * Notification or ringtone usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 10 * @useinstead ohos.multimedia.audio.StreamUsage.STREAM_USAGE_RINGTONE */ STREAM_USAGE_NOTIFICATION_RINGTONE = 6, /** * Ringtone usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_RINGTONE = 6, /** * Notification usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_NOTIFICATION = 7, /** * Accessibility usage, such as screen reader. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_ACCESSIBILITY = 8, /** * System usage, such as screen lock or key click. * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 10 */ STREAM_USAGE_SYSTEM = 9, /** * Movie or video usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_MOVIE = 10, /** * Game sound effect usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_GAME = 11, /** * Audiobook usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_AUDIOBOOK = 12, /** * Navigation usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ STREAM_USAGE_NAVIGATION = 13, /** * DTMF dial tone usage. * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 10 */ STREAM_USAGE_DTMF = 14, /** * Enforced tone usage, such as camera shutter. * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 10 */ STREAM_USAGE_ENFORCED_TONE = 15, /** * Ultrasonic playing usage. This type is only used for msdp condition. * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 10 */ STREAM_USAGE_ULTRASONIC = 16, } /** * Enumerates the audio interrupt request type. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ enum InterruptRequestType { /** * Default type to request audio interrupt. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ INTERRUPT_REQUEST_TYPE_DEFAULT = 0, } /** * Describes audio stream information. * @typedef AudioStreamInfo * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ interface AudioStreamInfo { /** * Sampling rate. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ samplingRate: AudioSamplingRate; /** * Audio channels. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ channels: AudioChannel; /** * Audio sample format. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ sampleFormat: AudioSampleFormat; /** * Audio encoding type. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ encodingType: AudioEncodingType; /** * Audio channel layout. * @type { ?AudioChannelLayout } * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ channelLayout?: AudioChannelLayout; } /** * Describes audio renderer information. * @typedef AudioRendererInfo * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ interface AudioRendererInfo { /** * Content type. * @type { ContentType } * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 * @deprecated since 10 * @useinstead ohos.multimedia.audio.AudioRendererInfo#usage */ /** * Content type. * @type { ?ContentType } * @syscap SystemCapability.Multimedia.Audio.Core * @since 10 */ content?: ContentType; /** * Stream usage. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ usage: StreamUsage; /** * Audio renderer flags. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ rendererFlags: number; } /** * Describes audio renderer filter. * @typedef AudioRendererFilter * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 9 */ interface AudioRendererFilter { /** * Application uid. * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 9 */ uid?: number; /** * Renderer information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @systemapi * @since 9 */ rendererInfo?: AudioRendererInfo; /** * AudioRenderer id. * @syscap SystemCapability.Multimedia.Audio.Renderer * @systemapi * @since 9 */ rendererId?: number; } /** * Describes audio renderer configuration options. * @typedef AudioRendererOptions * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ interface AudioRendererOptions { /** * Stream information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ streamInfo: AudioStreamInfo; /** * Renderer information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ rendererInfo: AudioRendererInfo; /** * Privacy configuration. * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ privacyType?: AudioPrivacyType; } /** * Enumerates audio stream privacy type for playback capture. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ enum AudioPrivacyType { /** * Privacy type that stream can be captured by third party applications. * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ PRIVACY_TYPE_PUBLIC = 0, /** * Privacy type that stream can not be captured. * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ PRIVACY_TYPE_PRIVATE = 1, } /** * Enumerates the interrupt modes. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 9 */ enum InterruptMode { /** * Mode that different stream share one interrupt unit. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 9 */ SHARE_MODE = 0, /** * Mode that each stream has independent interrupt unit. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 9 */ INDEPENDENT_MODE = 1 } /** * Enumerates the audio renderer rates. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ enum AudioRendererRate { /** * Normal rate. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ RENDER_RATE_NORMAL = 0, /** * Double rate. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ RENDER_RATE_DOUBLE = 1, /** * Half rate. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ RENDER_RATE_HALF = 2 } /** * Enumerates the interrupt types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ enum InterruptType { /** * Audio playback interruption started. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ INTERRUPT_TYPE_BEGIN = 1, /** * Audio playback interruption ended. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ INTERRUPT_TYPE_END = 2 } /** * Enumerates the interrupt hints. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ enum InterruptHint { /** * None. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ INTERRUPT_HINT_NONE = 0, /** * Resume the playback. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ INTERRUPT_HINT_RESUME = 1, /** * Paused/Pause the playback. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ INTERRUPT_HINT_PAUSE = 2, /** * Stopped/Stop the playback. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ INTERRUPT_HINT_STOP = 3, /** * Ducked the playback. (In ducking, the audio volume is reduced, but not silenced.) * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 */ INTERRUPT_HINT_DUCK = 4, /** * Unducked the playback. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ INTERRUPT_HINT_UNDUCK = 5, } /** * Enumerates the interrupt force types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ enum InterruptForceType { /** * Forced action taken by system. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ INTERRUPT_FORCE = 0, /** * Share type, application can choose to take action or ignore. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ INTERRUPT_SHARE = 1 } /** * Describes the interrupt event received by the app when playback is interrupted. * @typedef InterruptEvent * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ interface InterruptEvent { /** * Indicates whether the interruption has started or finished. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ eventType: InterruptType; /** * Indicates whether the action is taken by system or to be taken by the app. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ forceType: InterruptForceType; /** * Indicates the kind of action. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ hintType: InterruptHint; } /** * Enumerates interrupt action types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ enum InterruptActionType { /** * Focus gain event. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ TYPE_ACTIVATED = 0, /** * Audio interruption event. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ TYPE_INTERRUPT = 1 } /** * Enumerates device change types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ enum DeviceChangeType { /** * Device connection. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ CONNECT = 0, /** * Device disconnection. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ DISCONNECT = 1, } /** * Enumerates audio scenes. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Communication * @since 8 */ enum AudioScene { /** * Default audio scene * @syscap SystemCapability.Multimedia.Audio.Communication * @since 8 */ AUDIO_SCENE_DEFAULT = 0, /** * Ringing audio scene * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi * @since 8 */ AUDIO_SCENE_RINGING = 1, /** * Phone call audio scene * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi * @since 8 */ AUDIO_SCENE_PHONE_CALL = 2, /** * Voice chat audio scene * @syscap SystemCapability.Multimedia.Audio.Communication * @since 8 */ AUDIO_SCENE_VOICE_CHAT = 3 } /** * Enumerates volume adjustment types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ enum VolumeAdjustType { /** * Adjust volume up. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ VOLUME_UP = 0, /** * Adjust volume down. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ VOLUME_DOWN = 1, } /** * Implements audio volume and audio device management. * @typedef AudioManager * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 */ interface AudioManager { /** * Sets the volume for a stream. This method uses an asynchronous callback to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio stream type. * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume */ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback): void; /** * Sets the volume for a stream. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio stream type. * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setVolume */ setVolume(volumeType: AudioVolumeType, volume: number): Promise; /** * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume */ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the volume of a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getVolume */ getVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the minimum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume */ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the minimum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMinVolume */ getMinVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the maximum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume */ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the maximum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getMaxVolume */ getMaxVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. * @param { DeviceFlag } deviceFlag - Audio device flag. * @param { AsyncCallback } callback - Callback used to return the device list. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices */ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback): void; /** * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. * @param { DeviceFlag } deviceFlag - Audio device flag. * @returns { Promise } Promise used to return the device list. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#getDevices */ getDevices(deviceFlag: DeviceFlag): Promise; /** * Mutes a stream. This method uses an asynchronous callback to return the result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute */ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; /** * Mutes a stream. This method uses a promise to return the result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#mute */ mute(volumeType: AudioVolumeType, mute: boolean): Promise; /** * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the mute status of the stream. * The value true means that the stream is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute */ isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether a stream is muted. This method uses a promise to return the result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the mute status of the stream. The value true means * that the stream is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMute */ isMute(volumeType: AudioVolumeType): Promise; /** * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the active status of the stream. * The value true means that the stream is active, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive */ isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether a stream is active. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the active status of the stream. The value true means * that the stream is active, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioStreamManager#isActive */ isActive(volumeType: AudioVolumeType): Promise; /** * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. * @permission ohos.permission.MICROPHONE * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute */ setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; /** * Mutes or unmutes the microphone. This method uses a promise to return the result. * @permission ohos.permission.MICROPHONE * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicrophoneMute */ setMicrophoneMute(mute: boolean): Promise; /** * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. * @permission ohos.permission.MICROPHONE * @param { AsyncCallback } callback - used to return the mute status of the microphone. The value * true means that the microphone is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute */ isMicrophoneMute(callback: AsyncCallback): void; /** * Checks whether the microphone is muted. This method uses a promise to return the query result. * @permission ohos.permission.MICROPHONE * @returns { Promise } Promise used to return the mute status of the microphone. The value * true means that the microphone is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#isMicrophoneMute */ isMicrophoneMute(): Promise; /** * Sets the ringer mode. This method uses an asynchronous callback to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioRingMode } mode - Ringer mode. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode */ setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; /** * Sets the ringer mode. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioRingMode } mode - Ringer mode. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setRingerMode */ setRingerMode(mode: AudioRingMode): Promise; /** * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. * @param { AsyncCallback } callback - Callback used to return the ringer mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode */ getRingerMode(callback: AsyncCallback): void; /** * Obtains the ringer mode. This method uses a promise to return the query result. * @returns { Promise } Promise used to return the ringer mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#getRingerMode */ getRingerMode(): Promise; /** * Sets an audio parameter. This method uses an asynchronous callback to return the result. * @permission ohos.permission.MODIFY_AUDIO_SETTINGS * @param { string } key - Key of the audio parameter to set. * @param { string } value - Value of the audio parameter to set. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters */ setAudioParameter(key: string, value: string, callback: AsyncCallback): void; /** * Sets an audio parameter. This method uses a promise to return the result. * @permission ohos.permission.MODIFY_AUDIO_SETTINGS * @param { string } key - Key of the audio parameter to set. * @param { string } value - Value of the audio parameter to set. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioManager#setExtraParameters */ setAudioParameter(key: string, value: string): Promise; /** * Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result. * @param { string } key - Key of the audio parameter whose value is to be obtained. * @param { AsyncCallback } callback - Callback used to return the value of the audio parameter. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters */ getAudioParameter(key: string, callback: AsyncCallback): void; /** * Obtains the value of an audio parameter. This method uses a promise to return the query result. * @param { string } key - Key of the audio parameter whose value is to be obtained. * @returns { Promise } Promise used to return the value of the audio parameter. * @syscap SystemCapability.Multimedia.Audio.Core * @since 7 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioManager#getExtraParameters */ getAudioParameter(key: string): Promise; /** * Sets extra audio parameters. This method uses a promise to return the result. * @permission ohos.permission.MODIFY_AUDIO_SETTINGS * @param { string } mainKey - Main key of the audio parameters to set. * @param { Record } kvpairs - Key-value pairs with subkeys and values to set. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 11 */ setExtraParameters(mainKey: string, kvpairs: Record): Promise; /** * Obtains the values of a certain key. This method uses a promise to return the query result. * @param { string } mainKey - Main key of the audio parameters to get. * @param { Array } subKeys - Sub keys of the audio parameters to get. * @returns { Promise> } Promise used to return the key-value pairs. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 11 */ getExtraParameters(mainKey: string, subKeys?: Array): Promise>; /** * Sets a device to the active state. This method uses an asynchronous callback to return the result. * @param { ActiveDeviceType } deviceType - Audio device type. * @param { boolean } active - Active status to set. The value true means to set the device to the active * status, and false means the opposite. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice */ setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback): void; /** * Sets a device to the active state. This method uses a promise to return the result. * @param { ActiveDeviceType } deviceType - Audio device type. * @param { boolean } active - Active status to set. The value true means to set the device to the active * status, and false means the opposite. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#setCommunicationDevice */ setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise; /** * Checks whether a device is active. This method uses an asynchronous callback to return the query result. * @param { ActiveDeviceType } deviceType - Audio device type. * @param { AsyncCallback } callback - Callback used to return the active status of the device. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive */ isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback): void; /** * Checks whether a device is active. This method uses a promise to return the query result. * @param { ActiveDeviceType } deviceType - Audio device type. * @returns { Promise } Promise used to return the active status of the device. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#isCommunicationDeviceActive */ isDeviceActive(deviceType: ActiveDeviceType): Promise; /** * Listens for system volume change events. This method uses a callback to get volume change events. * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. * @param { Callback } callback - Callback used to get the system volume change event. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 8 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeManager#event:volumeChange */ on(type: 'volumeChange', callback: Callback): void; /** * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. * @param { Callback } callback - Callback used to get the updated ringer mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi * @since 8 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#event:ringerModeChange */ on(type: 'ringerModeChange', callback: Callback): void; /** * Sets the audio scene mode to change audio strategies. This method uses an asynchronous callback to return the * result. * @param { AudioScene } scene - Audio scene mode. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi * @since 8 */ setAudioScene(scene: AudioScene, callback: AsyncCallback): void; /** * Sets the audio scene mode to change audio strategies. This method uses a promise to return the result. * @param { AudioScene } scene - Audio scene mode. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Communication * @systemapi * @since 8 */ setAudioScene(scene: AudioScene): Promise; /** * Obtains the audio scene mode. This method uses an asynchronous callback to return the query result. * @param { AsyncCallback } callback - Callback used to return the audio scene mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 8 */ getAudioScene(callback: AsyncCallback): void; /** * Obtains the audio scene mode. This method uses a promise to return the query result. * @returns { Promise } Promise used to return the audio scene mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 8 */ getAudioScene(): Promise; /** * Obtains the audio scene mode. * @returns { AudioScene } Current audio scene mode. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 10 */ getAudioSceneSync(): AudioScene; /** * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive * the callback. * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. * @param { Callback } callback - Callback used to obtain the device update details. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange */ on(type: 'deviceChange', callback: Callback): void; /** * UnSubscribes to device change events. * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. * @param { Callback } callback - Callback used to obtain the device update details. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.AudioRoutingManager#event:deviceChange */ off(type: 'deviceChange', callback?: Callback): void; /** * Listens for audio interruption events. When the audio of an application is interrupted by another application, * the callback is invoked to notify the former application. * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. * @param { AudioInterrupt } interrupt - Parameters of the audio interruption event type. * @param { Callback } callback - Callback invoked for the audio interruption event. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt */ on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback): void; /** * Cancels the listening of audio interruption events. * @param { 'interrupt' } type - Type of the event to listen for. Only the interrupt event is supported. * @param { AudioInterrupt } interrupt - Input parameters of the audio interruption event. * @param { Callback } callback - Callback invoked for the audio interruption event. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#event:audioInterrupt */ off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback): void; /** * Obtains an {@link AudioVolumeManager} instance. * @returns { AudioVolumeManager } AudioVolumeManager instance. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getVolumeManager(): AudioVolumeManager; /** * Obtains an {@link AudioStreamManager} instance. * @returns { AudioStreamManager } AudioStreamManager instance. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ getStreamManager(): AudioStreamManager; /** * Obtains an {@link AudioRoutingManager} instance. * @returns { AudioRoutingManager } AudioRoutingManager instance. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ getRoutingManager(): AudioRoutingManager; /** * Obtains an {@link AudioSpatializationManager} instance. * @returns { AudioSpatializationManager } AudioSpatializationManager instance. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ getSpatializationManager(): AudioSpatializationManager; } /** * Enumerates audio interrupt request result type. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ enum InterruptRequestResultType { /** * Request audio interrupt success * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ INTERRUPT_REQUEST_GRANT = 0, /** * Request audio interrupt fail, may have higher priority type * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ INTERRUPT_REQUEST_REJECT = 1 } /** * Describes audio interrupt operation results. * @typedef InterruptResult * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ interface InterruptResult { /** * Interrupt request or abandon result. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ requestResult: InterruptRequestResultType; /** * Interrupt node as a unit to receive interrupt change event. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @systemapi * @since 9 */ interruptNode: number; } /** * Implements audio router management. * @typedef AudioRoutingManager * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ interface AudioRoutingManager { /** * Obtains the audio devices with a specific flag. This method uses an asynchronous callback to return the query result. * @param { DeviceFlag } deviceFlag - Audio device flag. * @param { AsyncCallback } callback - Callback used to return the device list. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback): void; /** * Obtains the audio devices with a specific flag. This method uses a promise to return the query result. * @param { DeviceFlag } deviceFlag - Audio device flag. * @returns { Promise } Promise used to return the device list. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ getDevices(deviceFlag: DeviceFlag): Promise; /** * Obtains the audio devices with a specific flag. * @param { DeviceFlag } deviceFlag - Audio device flag. * @returns { AudioDeviceDescriptors } The device list. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getDevicesSync(deviceFlag: DeviceFlag): AudioDeviceDescriptors; /** * Subscribes to device change events. When a device is connected/disconnected, registered clients will receive * the callback. * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. * @param { DeviceFlag } deviceFlag - Audio device flag. * @param { Callback } callback - Callback used to obtain the device update details. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void; /** * UnSubscribes to device change events. * @param { 'deviceChange' } type - Type of the event to listen for. Only the deviceChange event is supported. * @param { Callback } callback - Callback used to obtain the device update details. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ off(type: 'deviceChange', callback?: Callback): void; /** * Obtains all the available audio devices with a specific device usage. * @param { DeviceUsage } deviceUsage - Audio device usage. * @returns { AudioDeviceDescriptors } The device list. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ getAvailableDevices(deviceUsage: DeviceUsage): AudioDeviceDescriptors; /** * Subscribes to available device change events. When a device is connected/disconnected, registered clients will receive * the callback. * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. * @param { DeviceUsage } deviceUsage - Audio device usage. * @param { Callback } callback - Callback used to obtain the device update details. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ on(type: 'availableDeviceChange', deviceUsage: DeviceUsage, callback: Callback): void; /** * UnSubscribes to available device change events. * @param { 'availableDeviceChange' } type - Type of the event to listen for. Only the availableDeviceChange event is supported. * @param { Callback } callback - Callback used to obtain the device update details. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 11 */ off(type: 'availableDeviceChange', callback?: Callback): void; /** * Sets a device to the active state. This method uses an asynchronous callback to return the result. * @param { CommunicationDeviceType } deviceType - Audio device type. * @param { boolean } active - Active status to set. The value true means to set the device to * the active status, and false means the opposite. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 9 */ setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean, callback: AsyncCallback): void; /** * Sets a device to the active state. This method uses a promise to return the result. * @param { CommunicationDeviceType } deviceType - Audio device type. * @param { boolean } active - Active status to set. The value true means to set the device to the active status, * and false means the opposite. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 9 */ setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean): Promise; /** * Checks whether a device is active. This method uses an asynchronous callback to return the query result. * @param { CommunicationDeviceType } deviceType - Audio device type. * @param { AsyncCallback } callback - Callback used to return the active status of the device. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 9 */ isCommunicationDeviceActive(deviceType: CommunicationDeviceType, callback: AsyncCallback): void; /** * Checks whether a device is active. This method uses a promise to return the query result. * @param { CommunicationDeviceType } deviceType - Audio device type. * @returns { Promise } Promise used to return the active status of the device. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 9 */ isCommunicationDeviceActive(deviceType: CommunicationDeviceType): Promise; /** * Checks whether a device is active. * @param { CommunicationDeviceType } deviceType - Audio device type. * @returns { boolean } The active status of the device. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Communication * @since 10 */ isCommunicationDeviceActiveSync(deviceType: CommunicationDeviceType): boolean; /** * Select the output device. This method uses an asynchronous callback to return the result. * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; /** * Select the output device. This method uses a promise to return the result. * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise; /** * Select the output device with desired AudioRenderer. This method uses an asynchronous callback to return the result. * @param { AudioRendererFilter } filter - Filter for AudioRenderer. * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; /** * Select the output device with desired AudioRenderer. This method uses a promise to return the result. * @param { AudioRendererFilter } filter - Filter for AudioRenderer. * @param { AudioDeviceDescriptors } outputAudioDevices - Audio device description * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise; /** * Select the input device. This method uses an asynchronous callback to return the result. * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ selectInputDevice(inputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback): void; /** * Select the input device. This method uses a promise to return the result. * @param { AudioDeviceDescriptors } inputAudioDevices - Audio device description * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ selectInputDevice(inputAudioDevices: AudioDeviceDescriptors): Promise; /** * Get output device for target audio renderer info. * @param { AudioRendererInfo } rendererInfo - Audio renderer information * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. Return by callback. * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback): void; /** * Get output device for target audio renderer info. * @param { AudioRendererInfo } rendererInfo - Audio renderer information. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. Return by promise. * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise; /** * Gets preferred output device for target audio renderer info. * @param { AudioRendererInfo } rendererInfo - Audio renderer information. * @returns { AudioDeviceDescriptors } The preferred devices. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getPreferredOutputDeviceForRendererInfoSync(rendererInfo: AudioRendererInfo): AudioDeviceDescriptors; /** * Subscribes to prefer output device change events. When prefer device for target audio renderer info changes, * registered clients will receive the callback. * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the * preferOutputDeviceChangeForRendererInfo event is supported. * @param { AudioRendererInfo } rendererInfo - Audio renderer information. * @param { Callback } callback - Callback used to obtain the changed prefer devices information. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback): void; /** * UnSubscribes to prefer output device change events. * @param { 'preferOutputDeviceChangeForRendererInfo' } type - Type of the event to listen for. Only the * preferOutputDeviceChangeForRendererInfo event is supported. * @param { Callback } callback - Callback used to obtain the changed prefer devices in subscribe. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback): void; /** * Get input device for target audio capturer info. * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by callback. * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo, callback: AsyncCallback): void; /** * Get input device for target audio capturer info. * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by promise. * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getPreferredInputDeviceForCapturerInfo(capturerInfo: AudioCapturerInfo): Promise; /** * Subscribes to preferred input device change events. When preferred device for target audio capturer info changes, * registered clients will receive the callback. * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. * @param { Callback } callback - Callback used to obtain the changed preferred devices information. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ on(type: 'preferredInputDeviceChangeForCapturerInfo', capturerInfo: AudioCapturerInfo, callback: Callback): void; /** * Unsubscribes to preferred input device change events. * @param { 'preferredInputDeviceChangeForCapturerInfo' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to obtain the changed preferred devices in subscribe. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ off(type: 'preferredInputDeviceChangeForCapturerInfo', callback?: Callback): void; /** * Gets preferred input device for target audio capturer info. * @param { AudioCapturerInfo } capturerInfo - Audio capturer information. * @returns { AudioDeviceDescriptors } The preferred devices. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getPreferredInputDeviceForCapturerInfoSync(capturerInfo: AudioCapturerInfo): AudioDeviceDescriptors; } /** * Implements audio stream management. * @typedef AudioStreamManager * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ interface AudioStreamManager { /** * Get information of current existing audio renderers. * @param { AsyncCallback } callback - Callback used to return the information * of current existing audio renderers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ getCurrentAudioRendererInfoArray(callback: AsyncCallback): void; /** * Get information of current existing audio renderers. * @returns { Promise } Promise used to return the information of current * existing audio renderers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ getCurrentAudioRendererInfoArray(): Promise; /** * Get information of current existing audio renderers. * @returns { AudioRendererChangeInfoArray } The information of current existing audio renderers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getCurrentAudioRendererInfoArraySync(): AudioRendererChangeInfoArray; /** * Get information of current existing audio capturers. * @param { AsyncCallback } callback - Callback used to return the information * of current existing audio capturers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ getCurrentAudioCapturerInfoArray(callback: AsyncCallback): void; /** * Get information of current existing audio capturers. * @returns { Promise } Promise used to return the information of current existing * audio capturers. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ getCurrentAudioCapturerInfoArray(): Promise; /** * Get information of current existing audio capturers. * @returns { AudioCapturerChangeInfoArray } The information of current existing audio capturers. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 10 */ getCurrentAudioCapturerInfoArraySync(): AudioCapturerChangeInfoArray; /** * Gets information of audio effects. * @param { StreamUsage } usage - Stream usage. * @param { AsyncCallback } callback - Callback used to return the information of audio effects. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getAudioEffectInfoArray(usage: StreamUsage, callback: AsyncCallback): void; /** * Gets information of audio effects. * @param { StreamUsage } usage - Stream usage. * @returns { Promise } Promise used to return the information of audio effects. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getAudioEffectInfoArray(usage: StreamUsage): Promise; /** * Gets information of audio effects. * @param { StreamUsage } usage - Stream usage. * @returns { AudioEffectInfoArray } The information of audio effects. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getAudioEffectInfoArraySync(usage: StreamUsage): AudioEffectInfoArray; /** * Listens for audio renderer change events. When there is any audio renderer change, * registered clients will receive the callback. * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. * @param { Callback } callback - Callback invoked for the audio renderer change event. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ on(type: 'audioRendererChange', callback: Callback): void; /** * UnSubscribes to audio renderer change events. * @param { 'audioRendererChange' } type - Type of the event to listen for. Only the audioRendererChange event is supported. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ off(type: 'audioRendererChange'): void; /** * Listens for audio capturer change events. When there is any audio capturer change, * registered clients will receive the callback. * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. * @param { Callback } callback - Callback invoked for the audio capturer change event. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ on(type: 'audioCapturerChange', callback: Callback): void; /** * UnSubscribes to audio capturer change events. * @param { 'audioCapturerChange' } type - Type of the event to listen for. Only the audioCapturerChange event is supported. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ off(type: 'audioCapturerChange'): void; /** * Checks whether a stream is active. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the active status of the stream. * The value true means that the stream is active, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ isActive(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether a stream is active. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the active status of the stream. The value * true means that the stream is active, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ isActive(volumeType: AudioVolumeType): Promise; /** * Checks whether a stream is active. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { boolean } The active status of the stream. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ isActiveSync(volumeType: AudioVolumeType): boolean; } /** * Implements audio volume management. * @typedef AudioVolumeManager * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ interface AudioVolumeManager { /** * Get the volume group list for a networkId. This method uses an asynchronous callback to return the result. * @param { string } networkId - Distributed deice net work id * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ getVolumeGroupInfos(networkId: string, callback: AsyncCallback): void; /** * Get the volume group list for a networkId. This method uses a promise to return the result. * @param { string } networkId - Distributed deice net work id * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ getVolumeGroupInfos(networkId: string): Promise; /** * Get the volume group list for a networkId. * @param { string } networkId - Distributed deice net work id * @returns { VolumeGroupInfos } Volume group info list. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ getVolumeGroupInfosSync(networkId: string): VolumeGroupInfos; /** * Obtains an AudioVolumeGroupManager instance. This method uses an asynchronous callback to return the result. * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getVolumeGroupManager(groupId: number, callback: AsyncCallback): void; /** * Obtains an AudioVolumeGroupManager instance. This method uses a promise to return the result. * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getVolumeGroupManager(groupId: number): Promise; /** * Obtains an AudioVolumeGroupManager instance. * @param { number } groupId - volume group id, use LOCAL_VOLUME_GROUP_ID in default * @returns { AudioVolumeGroupManager } The audio volume group manager instance. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getVolumeGroupManagerSync(groupId: number): AudioVolumeGroupManager; /** * Listens for system volume change events. This method uses a callback to get volume change events. * @param { 'volumeChange' } type - Type of the event to listen for. Only the volumeChange event is supported. * @param { Callback } callback - Callback used to get the system volume change event. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ on(type: 'volumeChange', callback: Callback): void; } /** * Implements audio volume group management. * @typedef AudioVolumeGroupManager * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ interface AudioVolumeGroupManager { /** * Sets the volume for a stream. This method uses an asynchronous callback to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio stream type. * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback): void; /** * Sets the volume for a stream. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio stream type. * @param { number } volume - Volume to set. The value range can be obtained by calling getMinVolume and getMaxVolume. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ setVolume(volumeType: AudioVolumeType, volume: number): Promise; /** * Obtains the volume of a stream. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the volume of a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the volume of a stream. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { number } Current system volume level. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getVolumeSync(volumeType: AudioVolumeType): number; /** * Obtains the minimum volume allowed for a stream. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the minimum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the minimum volume allowed for a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the minimum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getMinVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the minimum volume allowed for a stream. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { number } Min volume level. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getMinVolumeSync(volumeType: AudioVolumeType): number; /** * Obtains the maximum volume allowed for a stream. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the maximum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Obtains the maximum volume allowed for a stream. This method uses a promise to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the maximum volume. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getMaxVolume(volumeType: AudioVolumeType): Promise; /** * Obtains the maximum volume allowed for a stream. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { number } Max volume level. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getMaxVolumeSync(volumeType: AudioVolumeType): number; /** * Mutes a stream. This method uses an asynchronous callback to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio stream type. * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback): void; /** * Mutes a stream. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio stream type. * @param { boolean } mute - Mute status to set. The value true means to mute the stream, and false means the opposite. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ mute(volumeType: AudioVolumeType, mute: boolean): Promise; /** * Checks whether a stream is muted. This method uses an asynchronous callback to return the query result. * @param { AudioVolumeType } volumeType - Audio stream type. * @param { AsyncCallback } callback - Callback used to return the mute status of the stream. The * value true means that the stream is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ isMute(volumeType: AudioVolumeType, callback: AsyncCallback): void; /** * Checks whether a stream is muted. This method uses a promise to return the result. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { Promise } Promise used to return the mute status of the stream. The value true * means that the stream is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ isMute(volumeType: AudioVolumeType): Promise; /** * Checks whether a stream is muted. * @param { AudioVolumeType } volumeType - Audio stream type. * @returns { boolean } The mute status of the stream. The value true * means that the stream is muted, and false means the opposite. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ isMuteSync(volumeType: AudioVolumeType): boolean; /** * Sets the ringer mode. This method uses an asynchronous callback to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioRingMode } mode - Ringer mode. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ setRingerMode(mode: AudioRingMode, callback: AsyncCallback): void; /** * Sets the ringer mode. This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioRingMode } mode - Ringer mode. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ setRingerMode(mode: AudioRingMode): Promise; /** * Obtains the ringer mode. This method uses an asynchronous callback to return the query result. * @param { AsyncCallback } callback - Callback used to return the ringer mode. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getRingerMode(callback: AsyncCallback): void; /** * Obtains the ringer mode. This method uses a promise to return the query result. * @returns { Promise } Promise used to return the ringer mode. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ getRingerMode(): Promise; /** * Obtains the ringer mode. * @returns { AudioRingMode } Current ringer mode. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getRingerModeSync(): AudioRingMode; /** * Listens for ringer mode change events. This method uses a callback to get ringer mode changes. * @param { 'ringerModeChange' } type - Type of the event to listen for. Only the ringerModeChange event is supported. * @param { Callback } callback - Callback used to get the updated ringer mode. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ on(type: 'ringerModeChange', callback: Callback): void; /** * Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result. * @permission ohos.permission.MANAGE_AUDIO_CONFIG * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute */ setMicrophoneMute(mute: boolean, callback: AsyncCallback): void; /** * Mutes or unmutes the microphone. This method uses a promise to return the result. * @permission ohos.permission.MANAGE_AUDIO_CONFIG * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioVolumeGroupManager#setMicMute */ setMicrophoneMute(mute: boolean): Promise; /** * Mutes or unmutes the microphone. This method uses a promise to return the result. * @permission ohos.permission.MANAGE_AUDIO_CONFIG * @param { boolean } mute - Mute status to set. The value true means to mute the microphone, and false means the opposite. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 11 */ setMicMute(mute: boolean): Promise; /** * Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result. * @param { AsyncCallback } callback - used to return the mute status of the microphone. The value * true means that the microphone is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ isMicrophoneMute(callback: AsyncCallback): void; /** * Checks whether the microphone is muted. This method uses a promise to return the query result. * @returns { Promise } Promise used to return the mute status of the microphone. The value true * means that the microphone is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ isMicrophoneMute(): Promise; /** * Checks whether the microphone is muted. * @returns { boolean } The mute status of the microphone. The value true * means that the microphone is muted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ isMicrophoneMuteSync(): boolean; /** * Listens for system microphone state change events. This method uses a callback to get microphone change events. * @param { 'micStateChange' } type - Type of the event to listen for. Only the micStateChange event is supported. * @param { Callback } callback - Callback used to get the system microphone state change event. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ on(type: 'micStateChange', callback: Callback): void; /** * Gets if this volume group is volume unadjustable. * @returns { boolean } Whether it is volume unadjustable. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ isVolumeUnadjustable(): boolean; /** * Adjusts system volume by step, volume type is decided by system. * This method uses an asynchronous callback to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { VolumeAdjustType } adjustType - Volume adjustment type. * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by callback. * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ adjustVolumeByStep(adjustType: VolumeAdjustType, callback: AsyncCallback): void; /** * Adjusts system volume by step, volume type is decided by system. * This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { VolumeAdjustType } adjustType - Volume adjustment type. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by promise. * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ adjustVolumeByStep(adjustType: VolumeAdjustType): Promise; /** * Adjusts system volume by step for target volume type. * This method uses an asynchronous callback to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio volume type. * @param { VolumeAdjustType } adjustType - Volume adjustment type. * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by callback. * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustType, callback: AsyncCallback): void; /** * Adjusts system volume by step for target volume type. * This method uses a promise to return the result. * @permission ohos.permission.ACCESS_NOTIFICATION_POLICY * @param { AudioVolumeType } volumeType - Audio volume type. * @param { VolumeAdjustType } adjustType - Volume adjustment type. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by promise. * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 10 */ adjustSystemVolumeByStep(volumeType: AudioVolumeType, adjustType: VolumeAdjustType): Promise; /** * Gets the volume db value that system calculate by volume type, volume level and device type. * This method uses an asynchronous callback to return the result. * @param { AudioVolumeType } volumeType - Audio volume type. * @param { number } volumeLevel - Volume level to set. * @param { DeviceType } device - Output device type. * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by callback. * @throws { BusinessError } 6800301 - System error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType, callback: AsyncCallback): void; /** * Gets the volume db value that system calculate by volume type, volume level and device type. * This method uses a promise to return the result. * @param { AudioVolumeType } volumeType - Audio volume type. * @param { number } volumeLevel - Volume level to set. * @param { DeviceType } device - Output device type. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by promise. * @throws { BusinessError } 6800301 - System error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getSystemVolumeInDb(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): Promise; /** * Gets the volume db value that system calculate by volume type, volume level and device type. * @param { AudioVolumeType } volumeType - Audio volume type. * @param { number } volumeLevel - Volume level to set. * @param { DeviceType } device - Output device type. * @returns { number } The system volume in dB. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 10 */ getSystemVolumeInDbSync(volumeType: AudioVolumeType, volumeLevel: number, device: DeviceType): number; } /** * Implements audio spatialization management. * @typedef AudioSpatializationManager * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ interface AudioSpatializationManager { /** * Checks whether spatialization is supported by system. * @returns { boolean } Whether spatialization is supported by system. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isSpatializationSupported(): boolean; /** * Checks whether spatialization is supported by the specified device. * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. * @returns { boolean } Whether spatialization is supported by the specified device. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isSpatializationSupportedForDevice(deviceDescriptor: AudioDeviceDescriptor): boolean; /** * Checks whether head tracking is supported by system. * @returns { boolean } Whether head tracking is supported by system. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isHeadTrackingSupported(): boolean; /** * Checks whether head tracking is supported by the specified device. * @param { AudioDeviceDescriptor } deviceDescriptor - Audio device description. * @returns { boolean } Whether head tracking is supported by the specified device. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isHeadTrackingSupportedForDevice(deviceDescriptor: AudioDeviceDescriptor): boolean; /** * Sets the spatialization enabled or disabled. This method uses an asynchronous callback to return the result. * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS * @param { boolean } enable - Spatialization enable state. * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 201 - Permission denied. Return by callback. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ setSpatializationEnabled(enable: boolean, callback: AsyncCallback): void; /** * Sets the spatialization enabled or disabled. This method uses a promise to return the result. * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS * @param { boolean } enable - Spatialization enable state. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 201 - Permission denied. Return by promise. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ setSpatializationEnabled(enable: boolean): Promise; /** * Checks whether the spatialization is enabled. * @returns { boolean } Whether the spatialization is enabled. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isSpatializationEnabled(): boolean; /** * Subscribes to the spatialization enable state change events. When the spatialization enable state changes, * registered clients will receive the callback. * @param { 'spatializationEnabledChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to get the spatialization enable state. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ on(type: 'spatializationEnabledChange', callback: Callback): void; /** * Unsubscribes to the spatialization enable state change events. * @param { 'spatializationEnabledChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to get the spatialization enable state. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ off(type: 'spatializationEnabledChange', callback?: Callback): void; /** * Sets the head tracking enabled or disabled. This method uses an asynchronous callback to return the result. * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS * @param { boolean } enable - Head tracking enable state. * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 201 - Permission denied. Return by callback. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ setHeadTrackingEnabled(enable: boolean, callback: AsyncCallback): void; /** * Sets the head tracking enabled or disabled. This method uses a promise to return the result. * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS * @param { boolean } enable - Head tracking enable state. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 201 - Permission denied. Return by promise. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ setHeadTrackingEnabled(enable: boolean): Promise; /** * Checks whether the head tracking is enabled. * @returns { boolean } Whether the head tracking is enabled. * @throws { BusinessError } 202 - Not system App. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isHeadTrackingEnabled(): boolean; /** * Subscribes to the head tracking enable state change events. When the head tracking enable state changes, * registered clients will receive the callback. * @param { 'headTrackingEnabledChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to get the head tracking enable state. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ on(type: 'headTrackingEnabledChange', callback: Callback): void; /** * Unsubscribes to the head tracking enable state change events. * @param { 'headTrackingEnabledChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to get the head tracking enable state. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ off(type: 'headTrackingEnabledChange', callback?: Callback): void; /** * Updates the spatial device state. * @permission ohos.permission.MANAGE_SYSTEM_AUDIO_EFFECTS * @param { AudioSpatialDeviceState } spatialDeviceState - Spatial device state. * @throws { BusinessError } 201 - Permission denied. * @throws { BusinessError } 202 - Not system App. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ updateSpatialDeviceState(spatialDeviceState: AudioSpatialDeviceState): void; } /** * Connect type for device. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ enum ConnectType { /** * Connect type for local device. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ CONNECT_TYPE_LOCAL = 1, /** * Connect type for distributed device. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ CONNECT_TYPE_DISTRIBUTED = 2 } /** * Describes an audio volume group. * @typedef VolumeGroupInfo * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ interface VolumeGroupInfo { /** * Device network id. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ readonly networkId: string; /** * Volume group id. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ readonly groupId: number; /** * Volume mapping group id. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ readonly mappingId: number; /** * Volume group name. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ readonly groupName: string; /** * Connect type of device for this group. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ readonly type: ConnectType; } /** * Array of VolumeGroupInfos, which is read-only. * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ type VolumeGroupInfos = Array>; /** * Array of AudioRendererChangeInfo, which is read-only. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ type AudioRendererChangeInfoArray = Array>; /** * Describes audio renderer change information. * @typedef AudioRendererChangeInfo * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ interface AudioRendererChangeInfo { /** * Audio stream unique id. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ readonly streamId: number; /** * Uid for audio renderer client application. * @syscap SystemCapability.Multimedia.Audio.Renderer * @systemapi * @since 9 */ readonly clientUid: number; /** * Audio renderer information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ readonly rendererInfo: AudioRendererInfo; /** * Audio state. * @syscap SystemCapability.Multimedia.Audio.Renderer * @systemapi * @since 9 */ readonly rendererState: AudioState; /** * Audio output devices. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ readonly deviceDescriptors: AudioDeviceDescriptors; } /** * Array of AudioCapturerChangeInfo, which is read-only. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ type AudioCapturerChangeInfoArray = Array>; /** * Describes audio capturer change information. * @typedef AudioCapturerChangeInfo * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ interface AudioCapturerChangeInfo { /** * Audio stream unique id. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ readonly streamId: number; /** * Uid for audio capturer client application. * @syscap SystemCapability.Multimedia.Audio.Capturer * @systemapi * @since 9 */ readonly clientUid: number; /** * Audio capturer information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ readonly capturerInfo: AudioCapturerInfo; /** * Audio state. * @syscap SystemCapability.Multimedia.Audio.Capturer * @systemapi * @since 9 */ readonly capturerState: AudioState; /** * Audio input devices. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ readonly deviceDescriptors: AudioDeviceDescriptors; /** * Audio capturer muted status. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 11 */ readonly muted?: boolean; } /** * Describes an audio device. * @typedef AudioDeviceDescriptor * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ interface AudioDeviceDescriptor { /** * Audio device role. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ readonly deviceRole: DeviceRole; /** * Audio device type. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ readonly deviceType: DeviceType; /** * Audio device id. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ readonly id: number; /** * Audio device name. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ readonly name: string; /** * Audio device address. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ readonly address: string; /** * Supported sampling rates. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ readonly sampleRates: Array; /** * Supported channel counts. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ readonly channelCounts: Array; /** * Supported channel masks. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ readonly channelMasks: Array; /** * Device network id * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ readonly networkId: string; /** * Interrupt group id * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ readonly interruptGroupId: number; /** * Volume group id * @syscap SystemCapability.Multimedia.Audio.Device * @systemapi * @since 9 */ readonly volumeGroupId: number; /** * Name used to display, considering distributed device situation. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ readonly displayName: string; /** * Supported encoding types. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ readonly encodingTypes?: Array; } /** * Array of AudioDeviceDescriptors, which is read-only. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ type AudioDeviceDescriptors = Array>; /** * Describes the volume event received by the app when the volume is changed. * @typedef VolumeEvent * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ interface VolumeEvent { /** * Volume type of the current stream. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ volumeType: AudioVolumeType; /** * Volume level. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ volume: number; /** * Whether to show the volume change in UI. * @syscap SystemCapability.Multimedia.Audio.Volume * @since 9 */ updateUi: boolean; /** * volumeGroup id * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ volumeGroupId: number; /** * Device network id * @syscap SystemCapability.Multimedia.Audio.Volume * @systemapi * @since 9 */ networkId: string; } /** * Describes the callback invoked for audio interruption or focus gain events.When the audio of an application * is interrupted by another application, the callback is invoked to notify the former application. * @typedef InterruptAction * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 * @useinstead ohos.multimedia.audio.InterruptEvent */ interface InterruptAction { /** * Event type. * The value TYPE_ACTIVATED means the focus gain event, and TYPE_INTERRUPT means the audio interruption event. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ actionType: InterruptActionType; /** * Type of the audio interruption event. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ type?: InterruptType; /** * Hint for the audio interruption event. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ hint?: InterruptHint; /** * Whether the focus is gained or released. The value true means that the focus is gained or released, * and false means that the focus fails to be gained or released. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ activated?: boolean; } /** * Describes input parameters of audio listening events. * @typedef AudioInterrupt * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ interface AudioInterrupt { /** * Audio stream usage type. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ streamUsage: StreamUsage; /** * Type of the media interrupted. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ contentType: ContentType; /** * Whether audio playback can be paused when it is interrupted. * The value true means that audio playback can be paused when it is interrupted, and false means the opposite. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 7 * @deprecated since 9 */ pauseWhenDucked: boolean; } /** * Describes the microphone state change event received by the app when the microphone state is changed. * @typedef MicStateChangeEvent * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ interface MicStateChangeEvent { /** * Mic mute state. * @syscap SystemCapability.Multimedia.Audio.Device * @since 9 */ mute: boolean; } /** * Describes the device change type and device information. * @typedef DeviceChangeAction * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ interface DeviceChangeAction { /** * Device change type. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ type: DeviceChangeType; /** * Device information. * @syscap SystemCapability.Multimedia.Audio.Device * @since 7 */ deviceDescriptors: AudioDeviceDescriptors; } /** * Enumerates channel blend mode. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ enum ChannelBlendMode { /** * No channel process. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ MODE_DEFAULT = 0, /** * Blend left and right channel. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ MODE_BLEND_LR = 1, /** * Replicate left to right channel. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ MODE_ALL_LEFT = 2, /** * Replicate right to left channel. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ MODE_ALL_RIGHT = 3, } /** * Enumerates audio stream device change reason. * @enum {number} * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ enum AudioStreamDeviceChangeReason { /** * Unknown. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ REASON_UNKNOWN = 0, /** * New device available. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ REASON_NEW_DEVICE_AVAILABLE = 1, /** * Old device unavailable. Applications should consider to pause the audio playback when this reason is * reported. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ REASON_OLD_DEVICE_UNAVAILABLE = 2, /** * Overrode by user or system. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ REASON_OVERRODE = 3, } /** * Audio stream device change info. * @typedef AudioStreamDeviceChangeInfo * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ interface AudioStreamDeviceChangeInfo { /** * Audio device descriptors after change. * @type {AudioDeviceDescriptors} * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ devices: AudioDeviceDescriptors; /** * Audio stream device change reason. * @type {AudioStreamDeviceChangeReason} * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ changeReason: AudioStreamDeviceChangeReason; } /** * Provides audio playback APIs. * @typedef AudioRenderer * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ interface AudioRenderer { /** * Defines the current render state. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ readonly state: AudioState; /** * Obtains the renderer information provided while creating a renderer instance. This method uses an asynchronous * callback to return the result. * @param { AsyncCallback } callback - Callback used to return the renderer information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getRendererInfo(callback: AsyncCallback): void; /** * Obtains the renderer information provided while creating a renderer instance. This method uses a promise to * return the result. * @returns { Promise } Promise used to return the renderer information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getRendererInfo(): Promise; /** * Obtains the renderer information provided while creating a renderer instance. * @returns { AudioRendererInfo } The renderer information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getRendererInfoSync(): AudioRendererInfo; /** * Obtains the renderer stream information. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the stream information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getStreamInfo(callback: AsyncCallback): void; /** * Obtains the renderer stream information. This method uses a promise to return the result. * @returns { Promise } Promise used to return the stream information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getStreamInfo(): Promise; /** * Obtains the renderer stream information. * @returns { AudioStreamInfo } The stream information. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getStreamInfoSync(): AudioStreamInfo; /** * Obtains the renderer stream id. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the stream id. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ getAudioStreamId(callback: AsyncCallback): void; /** * Obtains the renderer stream id. This method uses a promise to return the result. * @returns { Promise } Promise used to return the stream id. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ getAudioStreamId(): Promise; /** * Obtains the renderer stream id. * @returns { number } The stream id. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getAudioStreamIdSync(): number; /** * Obtains the current audio effect mode. This method uses an asynchronous callback to return the query result. * @param { AsyncCallback } callback - Callback used to return the current audio effect mode. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getAudioEffectMode(callback: AsyncCallback): void; /** * Obtains the current audio effect mode. This method uses a promise to return the query result. * @returns { Promise } Promise used to return the current audio effect mode. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getAudioEffectMode(): Promise; /** * Sets the current audio effect mode. This method uses an asynchronous callback to return the result. * @param { AudioEffectMode } mode - Audio effect mode. * @param { AsyncCallback } callback - Callback used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by callback. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ setAudioEffectMode(mode: AudioEffectMode, callback: AsyncCallback): void; /** * Sets the current audio effect mode. This method uses a promise to return the result. * @param { AudioEffectMode } mode - Audio effect mode. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ setAudioEffectMode(mode: AudioEffectMode): Promise; /** * Starts the renderer. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ start(callback: AsyncCallback): void; /** * Starts the renderer. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ start(): Promise; /** * Writes the buffer. This method uses an asynchronous callback to return the result. * @param { ArrayBuffer } buffer - Buffer to be written. * @param { AsyncCallback } callback - Returns the number of bytes written if the operation is successful. * Returns an error code otherwise. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData */ write(buffer: ArrayBuffer, callback: AsyncCallback): void; /** * Writes the buffer. This method uses a promise to return the result. * @param { ArrayBuffer } buffer - Buffer to be written. * @returns { Promise } Returns the number of bytes written if the operation is successful. * Returns an error code otherwise. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#event:writeData */ write(buffer: ArrayBuffer): Promise; /** * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an * asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the timestamp. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getAudioTime(callback: AsyncCallback): void; /** * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a * promise to return the result. * @returns { Promise } Promise used to return the timestamp. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getAudioTime(): Promise; /** * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. * @returns { number } The audio timestamp. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getAudioTimeSync(): number; /** * Drains the playback buffer. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ drain(callback: AsyncCallback): void; /** * Drains the playback buffer. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ drain(): Promise; /** * Flushes the playback buffer. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @throws { BusinessError } 6800103 - Operation not permit at current state. Return by promise. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 11 */ flush(): Promise; /** * Pauses rendering. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ pause(callback: AsyncCallback): void; /** * Pauses rendering. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ pause(): Promise; /** * Stops rendering. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ stop(callback: AsyncCallback): void; /** * Stops rendering. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ stop(): Promise; /** * Releases the renderer. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ release(callback: AsyncCallback): void; /** * Releases the renderer. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ release(): Promise; /** * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses an asynchronous callback to * return the result. * @param { AsyncCallback } callback - Callback used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getBufferSize(callback: AsyncCallback): void; /** * Obtains a reasonable minimum buffer size in bytes for rendering. This method uses a promise to return the result. * @returns { Promise } Promise used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ getBufferSize(): Promise; /** * Obtains a reasonable minimum buffer size in bytes for rendering. * @returns { number } The audio buffer size. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getBufferSizeSync(): number; /** * Sets the render rate. This method uses an asynchronous callback to return the result. * @param { AudioRendererRate } rate - Audio render rate. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed */ setRenderRate(rate: AudioRendererRate, callback: AsyncCallback): void; /** * Sets the render rate. This method uses a promise to return the result. * @param { AudioRendererRate } rate - Audio render rate. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#setSpeed */ setRenderRate(rate: AudioRendererRate): Promise; /** * Sets the playback speed. * @param { number } speed - Audio playback speed. The value type is float, form 0.25 to 4.0. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 11 */ setSpeed(speed: number): void; /** * Obtains the current render rate. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the audio render rate. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed */ getRenderRate(callback: AsyncCallback): void; /** * Obtains the current render rate. This method uses a promise to return the result. * @returns { Promise } Promise used to return the audio render rate. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed */ getRenderRate(): Promise; /** * Obtains the current render rate. * @returns { AudioRendererRate } The audio render rate. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioRenderer#getSpeed */ getRenderRateSync(): AudioRendererRate; /** * Obtains the current playback speed. * @returns { number } The playback speed. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 11 */ getSpeed(): number; /** * Set interrupt mode. * @param { InterruptMode } mode - The interrupt mode. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 9 */ setInterruptMode(mode: InterruptMode, callback: AsyncCallback): void; /** * Set interrupt mode. * @param { InterruptMode } mode - The interrupt mode. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 9 */ setInterruptMode(mode: InterruptMode): Promise; /** * Set interrupt mode. * @param { InterruptMode } mode - The interrupt mode. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 10 */ setInterruptModeSync(mode: InterruptMode): void; /** * Sets the volume for this stream. This method uses an asynchronous callback to return the result. * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ setVolume(volume: number, callback: AsyncCallback): void; /** * Sets the volume for a stream. This method uses a promise to return the result. * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 9 */ setVolume(volume: number): Promise; /** * Changes the volume with ramp for a duration. * @param { number } volume - Volume to set. The value type is float, form 0.0 to 1.0. * @param { number } duration - Duration for volume ramp, in millisecond. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 11 */ setVolumeWithRamp(volume: number, duration: number): void; /** * Gets the min volume this stream can set. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getMinStreamVolume(callback: AsyncCallback): void; /** * Gets the min volume this stream can set. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getMinStreamVolume(): Promise; /** * Gets the min volume this stream can set. * @returns { number } Min stream volume. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getMinStreamVolumeSync(): number; /** * Gets the max volume this stream can set. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getMaxStreamVolume(callback: AsyncCallback): void; /** * Gets the max volume this stream can set. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getMaxStreamVolume(): Promise; /** * Gets the max volume this stream can set. * @returns { number } Max stream volume. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getMaxStreamVolumeSync(): number; /** * Gets buffer underflow count. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getUnderflowCount(callback: AsyncCallback): void; /** * Gets buffer underflow count. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getUnderflowCount(): Promise; /** * Gets buffer underflow count. * @returns { number } Underflow count number. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ getUnderflowCountSync(): number; /** * Gets the output device or devices for this stream. * This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getCurrentOutputDevices(callback: AsyncCallback): void; /** * Gets the output device or devices for this stream. * This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getCurrentOutputDevices(): Promise; /** * Gets the output device or devices for this stream. * @returns { AudioDeviceDescriptors } Output device or devices. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ getCurrentOutputDevicesSync(): AudioDeviceDescriptors; /** * Sets channel blend mode for this stream. * @param { ChannelBlendMode } mode - Target channel blend mode. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @throws { BusinessError } 6800103 - Operation not permit at current state. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 11 */ setChannelBlendMode(mode: ChannelBlendMode): void; /** * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is * triggered when audio playback is interrupted. * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. * @param { Callback } callback - Callback used to listen for interrupt callback. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 9 */ 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. * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ on(type: 'markReach', frame: number, callback: Callback): void; /** * Unsubscribes from mark reached events. * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ off(type: 'markReach'): void; /** * Subscribes to period reached events. When the period of frame rendering reaches the value of frame parameter, * the callback is invoked. * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. * @param { number } frame - Period during which frame rendering is listened. The value must be greater than 0. * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ on(type: 'periodReach', frame: number, callback: Callback): void; /** * Unsubscribes from period reached events. * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ off(type: 'periodReach'): void; /** * Subscribes audio state change event callback. * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. * @param { Callback } callback - Callback invoked when state change. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 8 */ on(type: 'stateChange', callback: Callback): void; /** * Subscribes output device change event callback. * The event is triggered when output device change for this stream. * @param { 'outputDeviceChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to listen device change event. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ on(type: 'outputDeviceChange', callback: Callback): void; /** * Subscribes output device change event callback. * The event is triggered when output device change for this stream. * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to listen device change event. * @throws { BusinessError } 401 - if input parameter type or number mismatch. * @throws { BusinessError } 6800101 - if input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ on(type: 'outputDeviceChangeWithInfo', callback: Callback): void; /** * Unsubscribes output device change event callback. * @param { 'outputDeviceChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used in subscribe. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 10 */ off(type: 'outputDeviceChange', callback?: Callback): void; /** * Unsubscribes output device change event callback. * @param { 'outputDeviceChangeWithInfo' } type - Type of the event to listen for. * @param { Callback } callback - Callback used in subscribe. * @throws { BusinessError } 401 - if input parameter type or number mismatch. * @throws { BusinessError } 6800101 - if input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ off(type: 'outputDeviceChangeWithInfo', callback?: Callback): void; /** * Subscribes audio data callback. * The event is triggered when audio buffer is available for writing more data. * @param { 'writeData' } type - Type of the event to listen for. * @param { Callback } callback - Callback with buffer to write. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 11 */ on(type: 'writeData', callback: Callback): void; /** * Unsubscribes audio data callback. * @param { 'writeData' } type - Type of the event to listen for. * @param { Callback } callback - Callback used in subscribe. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 11 */ off(type: 'writeData', callback?: Callback): void; } /** * Enumerates source types. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ enum SourceType { /** * Invalid source type. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SOURCE_TYPE_INVALID = -1, /** * Mic source type. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SOURCE_TYPE_MIC = 0, /** * Voice recognition source type. * @syscap SystemCapability.Multimedia.Audio.Core * @since 9 */ SOURCE_TYPE_VOICE_RECOGNITION = 1, /** * Playback capture source type. * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ SOURCE_TYPE_PLAYBACK_CAPTURE = 2, /** * Wakeup source type. * @permission ohos.permission.MANAGE_INTELLIGENT_VOICE * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 10 */ SOURCE_TYPE_WAKEUP = 3, /** * Voice call source type. * @permission ohos.permission.RECORD_VOICE_CALL * @syscap SystemCapability.Multimedia.Audio.Core * @systemapi * @since 11 */ SOURCE_TYPE_VOICE_CALL = 4, /** * Voice communication source type. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ SOURCE_TYPE_VOICE_COMMUNICATION = 7 } /** * Describes audio capturer information. * @typedef AudioCapturerInfo * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ interface AudioCapturerInfo { /** * Audio source type. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ source: SourceType; /** * Audio capturer flags. * @syscap SystemCapability.Multimedia.Audio.Core * @since 8 */ capturerFlags: number; } /** * Describes audio capturer configuration options. * @typedef AudioCapturerOptions * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ interface AudioCapturerOptions { /** * Stream information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ streamInfo: AudioStreamInfo; /** * Capturer information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ capturerInfo: AudioCapturerInfo; /** * Playback capture config. * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ playbackCaptureConfig?: AudioPlaybackCaptureConfig; } /** * Describe playback capture filtering options * @typedef CaptureFilterOptions * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ interface CaptureFilterOptions { /** * Filter by stream usages. If you want to capture voice streams, additional permission is needed. * @permission ohos.permission.CAPTURE_VOICE_DOWNLINK_AUDIO * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ /** * Filter by stream usages. But not allow to capture voice streams. * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 11 */ usages: Array; } /** * Describe playback capture config object. * @typedef AudioPlaybackCaptureConfig * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ interface AudioPlaybackCaptureConfig { /** * Add filter options to decide which streams to be captured. * @syscap SystemCapability.Multimedia.Audio.PlaybackCapture * @since 10 */ filterOptions: CaptureFilterOptions; } /** * Provides APIs for audio recording. * @typedef AudioCapturer * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ interface AudioCapturer { /** * Defines the current capture state. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ readonly state: AudioState; /** * Obtains the capturer information provided while creating a capturer instance. This method uses an asynchronous * callback to return the result. * @param { AsyncCallback } callback - Callback used to return the capturer information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getCapturerInfo(callback: AsyncCallback): void; /** * Obtains the capturer information provided while creating a capturer instance. This method uses a promise to * return the result. * @returns { Promise } Promise used to return the capturer information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getCapturerInfo(): Promise; /** * Obtains the capturer information provided while creating a capturer instance. * @returns { AudioCapturerInfo } The capturer information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 10 */ getCapturerInfoSync(): AudioCapturerInfo; /** * Obtains the capturer stream information. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the stream information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getStreamInfo(callback: AsyncCallback): void; /** * Obtains the capturer stream information. This method uses a promise to return the result. * @returns { Promise } Promise used to return the stream information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getStreamInfo(): Promise; /** * Obtains the capturer stream information. * @returns { AudioStreamInfo } The stream information. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 10 */ getStreamInfoSync(): AudioStreamInfo; /** * Obtains the capturer stream id. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the stream id. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ getAudioStreamId(callback: AsyncCallback): void; /** * Obtains the capturer stream id. This method uses a promise to return the result. * @returns { Promise } Promise used to return the stream id. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 9 */ getAudioStreamId(): Promise; /** * Obtains the capturer stream id. * @returns { number } The stream id. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 10 */ getAudioStreamIdSync(): number; /** * Starts capturing. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ start(callback: AsyncCallback): void; /** * Starts capturing. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ start(): Promise; /** * Reads the buffer from the audio capturer. This method uses an asynchronous callback to return the result. * @param { number } size - Number of bytes to read. * @param { boolean } isBlockingRead - Whether the read operation should be blocked. * @param { AsyncCallback } callback - Callback used to return the buffer. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData */ read(size: number, isBlockingRead: boolean, callback: AsyncCallback): void; /** * Reads the buffer from the audio capturer. This method uses a promise to return the result. * @param { number } size - Number of bytes to read. * @param { boolean } isBlockingRead - Whether the read operation should be blocked. * @returns { Promise } Returns the buffer data read if the operation is successful. * Returns an error code otherwise. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 * @deprecated since 11 * @useinstead ohos.multimedia.audio.AudioCapturer#event:readData */ read(size: number, isBlockingRead: boolean): Promise; /** * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses an * asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the timestamp. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getAudioTime(callback: AsyncCallback): void; /** * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. This method uses a * promise to return the result. * @returns { Promise } Promise used to return the timestamp. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getAudioTime(): Promise; /** * Obtains the timestamp in Unix epoch time (starts from January 1, 1970), in nanoseconds. * @returns { number } The audio timestamp. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 10 */ getAudioTimeSync(): number; /** * Stops capturing. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ stop(callback: AsyncCallback): void; /** * Stops capturing. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ stop(): Promise; /** * Releases the capturer. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ release(callback: AsyncCallback): void; /** * Releases the capturer. This method uses a promise to return the result. * @returns { Promise } - Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ release(): Promise; /** * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses an asynchronous callback to * return the result. * @param { AsyncCallback } callback - Callback used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getBufferSize(callback: AsyncCallback): void; /** * Obtains a reasonable minimum buffer size in bytes for capturing. This method uses a promise to return the result. * @returns { Promise } Promise used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ getBufferSize(): Promise; /** * Obtains a reasonable minimum buffer size in bytes for capturing. * @returns { number } Promise used to return the buffer size. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 10 */ getBufferSizeSync(): number; /** * Gets the input device or devices for this stream. * @returns { AudioDeviceDescriptors } Descriptors of input devices. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ getCurrentInputDevices(): AudioDeviceDescriptors; /** * Gets full capturer info for this stream. * @returns { AudioCapturerChangeInfo } Full capture info. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ getCurrentAudioCapturerChangeInfo(): AudioCapturerChangeInfo; /** * Subscribes to mark reached events. When the number of frames captured reaches the value of the frame parameter, * the callback is invoked. * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. * @param { number } frame - Number of frames to trigger the event. The value must be greater than 0. * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ on(type: 'markReach', frame: number, callback: Callback): void; /** * Unsubscribes from the mark reached events. * @param { 'markReach' } type - Type of the event to listen for. Only the markReach event is supported. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ off(type: 'markReach'): void; /** * Subscribes to period reached events. When the period of frame capturing reaches the value of frame parameter, * the callback is invoked. * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. * @param { number } frame - Period during which frame capturing is listened. The value must be greater than 0. * @param { Callback } callback - Callback invoked when the event is triggered. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ on(type: 'periodReach', frame: number, callback: Callback): void; /** * Unsubscribes from period reached events. * @param { 'periodReach' } type - Type of the event to listen for. Only the periodReach event is supported. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ off(type: 'periodReach'): void; /** * Subscribes audio state change event callback. * @param { 'stateChange' } type - Type of the event to listen for. Only the stateChange event is supported. * @param { Callback } callback - Callback used to listen for the audio state change event. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 8 */ on(type: 'stateChange', callback: Callback): void; /** * Listens for audio interrupt events. This method uses a callback to get interrupt events. The interrupt event is * triggered when audio recording is interrupted. * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. * @param { Callback } callback - Callback used to listen for interrupt callback. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 10 */ on(type: 'audioInterrupt', callback: Callback): void; /** * UnSubscribes to audio interrupt events. * @param { 'audioInterrupt' } type - Type of the event to listen for. Only the audioInterrupt event is supported. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Invalid parameter error. * @syscap SystemCapability.Multimedia.Audio.Interrupt * @since 10 */ off(type: 'audioInterrupt'): void; /** * Subscribes input device change event callback. * The event is triggered when input device change for this stream. * @param { 'inputDeviceChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to listen device change event. * @throws { BusinessError } 401 - if input parameter type or number mismatch. * @throws { BusinessError } 6800101 - if input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ on(type: 'inputDeviceChange', callback: Callback): void; /** * Unsubscribes input device change event callback. * @param { 'inputDeviceChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used in subscribe. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Device * @since 11 */ off(type: 'inputDeviceChange', callback?: Callback): void; /** * Subscribes audio capturer info change event callback. * The event is triggered when input device change for this stream. * @param { 'audioCapturerChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used to listen device change event. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 11 */ on(type: 'audioCapturerChange', callback: Callback): void; /** * Unsubscribes audio capturer info change event callback. * @param { 'audioCapturerChange' } type - Type of the event to listen for. * @param { Callback } callback - Callback used in subscribe. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 11 */ off(type: 'audioCapturerChange', callback?: Callback): void; /** * Subscribes audio data callback. * The event is triggered when audio buffer is available for reading more data. * @param { 'readData' } type - Type of the event to listen for. * @param { Callback } callback - Callback with the buffer to read. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 11 */ on(type: 'readData', callback: Callback): void; /** * Unsubscribes audio data callback. * @param { 'readData' } type - Type of the event to listen for. * @param { Callback } callback - Callback used in subscribe. * @throws { BusinessError } 401 - Input parameter type or number mismatch. * @throws { BusinessError } 6800101 - Input parameter value error. * @syscap SystemCapability.Multimedia.Audio.Capturer * @since 11 */ off(type: 'readData', callback?: Callback): void; } /** * Enumerates tone types for player. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ enum ToneType { /** * Dial tone for key 0. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_0 = 0, /** * Dial tone for key 1. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_1 = 1, /** * Dial tone for key 2. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_2 = 2, /** * Dial tone for key 3. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_3 = 3, /** * Dial tone for key 4. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_4 = 4, /** * Dial tone for key 5. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_5 = 5, /** * Dial tone for key 6. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_6 = 6, /** * Dial tone for key 7. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_7 = 7, /** * Dial tone for key 8. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_8 = 8, /** * Dial tone for key 9. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_9 = 9, /** * Dial tone for key *. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_S = 10, /** * Dial tone for key #. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_P = 11, /** * Dial tone for key A. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_A = 12, /** * Dial tone for key B. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_B = 13, /** * Dial tone for key C. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_C = 14, /** * Dial tone for key D. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_DIAL_D = 15, /** * Supervisory tone for dial. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_SUPERVISORY_DIAL = 100, /** * Supervisory tone for busy. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_SUPERVISORY_BUSY = 101, /** * Supervisory tone for dial. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_SUPERVISORY_CONGESTION = 102, /** * Supervisory tone for radio path acknowledgment. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK = 103, /** * Supervisory tone for radio path not available. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE = 104, /** * Supervisory tone for call waiting. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING = 106, /** * Supervisory tone for ringtone. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_SUPERVISORY_RINGTONE = 107, /** * Proprietary tone for beep. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_PROPRIETARY_BEEP = 200, /** * Proprietary tone for positive acknowledgment. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_PROPRIETARY_ACK = 201, /** * Proprietary tone for prompt. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_PROPRIETARY_PROMPT = 203, /** * Proprietary tone for double beep. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP = 204, } /** * Provides APIs for tone playing. * @typedef TonePlayer * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ interface TonePlayer { /** * Loads tone. This method uses an asynchronous callback to return the result. * @param { ToneType } type - Tone type to play. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ load(type: ToneType, callback: AsyncCallback): void; /** * Loads tone. This method uses a promise to return the result. * @param { ToneType } type - Tone type to play. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ load(type: ToneType): Promise; /** * Starts player. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ start(callback: AsyncCallback): void; /** * Starts player. This method uses a promise to return the result. * @returns { Promise }Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ start(): Promise; /** * Stops player. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ stop(callback: AsyncCallback): void; /** * Stops player. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ stop(): Promise; /** * Releases the player. This method uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ release(callback: AsyncCallback): void; /** * Releases the player. This method uses a promise to return the result. * @returns { Promise } Promise used to return the result. * @syscap SystemCapability.Multimedia.Audio.Tone * @systemapi * @since 9 */ release(): Promise; } /** * Array of AudioEffectMode, which is read-only. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ type AudioEffectInfoArray = Array>; /** * Describes an audio effect mode group. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ enum AudioEffectMode { /** * Audio Effect Mode effect none. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ EFFECT_NONE = 0, /** * Audio Effect Mode effect default. * @syscap SystemCapability.Multimedia.Audio.Renderer * @since 10 */ EFFECT_DEFAULT = 1, } /** * Describes spatial device state. * @typedef AudioSpatialDeviceState * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ interface AudioSpatialDeviceState { /** * Spatial device address. * @type { string } * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ address: string; /** * Whether the spatial device supports spatial rendering. * @type { boolean } * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isSpatializationSupported: boolean; /** * Whether the spatial device supports head tracking. * @type { boolean } * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ isHeadTrackingSupported: boolean; /** * Spatial device type. * @type { AudioSpatialDeviceType } * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ spatialDeviceType: AudioSpatialDeviceType; } /** * Describes a spatial device type group. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ enum AudioSpatialDeviceType { /** * Audio Spatial Device Type none. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ SPATIAL_DEVICE_TYPE_NONE = 0, /** * Audio Spatial Device Type in-ear headphone. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ SPATIAL_DEVICE_TYPE_IN_EAR_HEADPHONE = 1, /** * Audio Spatial Device Type half-in-ear headphone. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ SPATIAL_DEVICE_TYPE_HALF_IN_EAR_HEADPHONE = 2, /** * Audio Spatial Device Type over-ear headphone. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ SPATIAL_DEVICE_TYPE_OVER_EAR_HEADPHONE = 3, /** * Audio Spatial Device Type glasses. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ SPATIAL_DEVICE_TYPE_GLASSES = 4, /** * Audio Spatial Device Type others. * @syscap SystemCapability.Multimedia.Audio.Spatialization * @systemapi * @since 11 */ SPATIAL_DEVICE_TYPE_OTHERS = 5, } /** * Audio AudioChannel Layout * A 64-bit integer indicates that the appearance and order of the speakers for recording or playback. * @enum { number } * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ enum AudioChannelLayout { /** * Unknown Channel Layout * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_UNKNOWN = 0x0, /** * Channel Layout For Mono, 1 channel in total * Speaker layout: front center(FC) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_MONO = 0x4, /** * Channel Layout For Stereo, 2 channels in total * Speaker layout: front left(FL), front right(FR) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_STEREO = 0x3, /** * Channel Layout For Stereo-Downmix, 2 channels in total * Speaker layout: Stereo left, stereo right * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_STEREO_DOWNMIX = 0x60000000, /** * Channel Layout For 2.1, 3 channels in total * Speaker layout: Stereo plus low-frequency effects(LFE) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_2POINT1 = 0xB, /** * Channel Layout For 3.0, 3 channels in total * Speaker layout: Stereo plus back center(BC) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_3POINT0 = 0x103, /** * Channel Layout For Surround, 3 channels in total * Speaker layout: Stereo plus FC * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_SURROUND = 0x7, /** * Channel Layout For 3.1, 4 channels in total * Speaker layout: Surround plus LFE * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_3POINT1 = 0xF, /** * Channel Layout For 4.0, 4 channels in total * Speaker layout: Surround plus BC * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_4POINT0 = 0x107, /** * Channel Layout For Quad, 4 channels in total * Speaker layout: Stereo plus left and right back speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_QUAD = 0x33, /** * Channel Layout For Quad-Side, 4 channels in total * Speaker layout: Stereo plus left and right side speakers(SL, SR) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_QUAD_SIDE = 0x603, /** * Channel Layout For 2.0.2, 4 channels in total * Speaker layout: Stereo plus left and right top side speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_2POINT0POINT2 = 0x3000000003, /** * Channel Layout For ORDER1-ACN-N3D First Order Ambisonic(FOA), 4 channels in total * First order, Ambisonic Channel Number(ACN) format, Normalization of three-D(N3D) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER1_ACN_N3D = 0x100000000001, /** * Channel Layout For ORDER1-ACN-SN3D FOA, 4 channels in total * First order, ACN format, Semi-Normalization of three-D(SN3D) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER1_ACN_SN3D = 0x100000001001, /** * Channel Layout For ORDER1-FUMA FOA, 4 channels in total * First order, Furse-Malham(FuMa) format * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER1_FUMA = 0x100000000101, /** * Channel Layout For 4.1, 5 channels in total * Speaker layout: 4.0 plus LFE * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_4POINT1 = 0x10F, /** * Channel Layout For 5.0, 5 channels in total * Speaker layout: Surround plus two side speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_5POINT0 = 0x607, /** * Channel Layout For 5.0-Back, 5 channels in total * Speaker layout: Surround plus two back speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_5POINT0_BACK = 0x37, /** * Channel Layout For 2.1.2, 5 channels in total * Speaker layout: 2.0.2 plus LFE * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_2POINT1POINT2 = 0x300000000B, /** * Channel Layout For 3.0.2, 5 channels in total * Speaker layout: 2.0.2 plus FC * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_3POINT0POINT2 = 0x3000000007, /** * Channel Layout For 5.1, 6 channels in total * Speaker layout: 5.0 plus LFE * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_5POINT1 = 0x60F, /** * Channel Layout For 5.1-Back, 6 channels in total * Speaker layout: 5.0-Back plus LFE * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_5POINT1_BACK = 0x3F, /** * Channel Layout For 6.0, 6 channels in total * Speaker layout: 5.0 plus BC * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_6POINT0 = 0x707, /** * Channel Layout For Hexagonal, 6 channels in total * Speaker layout: 5.0-Back plus BC * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_HEXAGONAL = 0x137, /** * Channel Layout For 3.1.2, 6 channels in total * Speaker layout: 3.1 plus two top front speakers(TFL, TFR) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_3POINT1POINT2 = 0x500F, /** * Channel Layout For 6.0-Front, 6 channels in total * Speaker layout: Quad-Side plus left and right front center speakers(FLC, FRC) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_6POINT0_FRONT = 0x6C3, /** * Channel Layout For 6.1, 7 channels in total * Speaker layout: 5.1 plus BC * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_6POINT1 = 0x70F, /** * Channel Layout For 6.1-Back, 7 channels in total * Speaker layout: 5.1-Back plus BC * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_6POINT1_BACK = 0x13F, /** * Channel Layout For 6.1-Front, 7 channels in total * Speaker layout: 6.0-Front plus LFE * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_6POINT1_FRONT = 0x6CB, /** * Channel Layout For 7.0, 7 channels in total * Speaker layout: 5.0 plus two back speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_7POINT0 = 0x637, /** * Channel Layout For 7.0-Front, 7 channels in total * Speaker layout: 5.0 plus left and right front center speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_7POINT0_FRONT = 0x6C7, /** * Channel Layout For 7.1, 8 channels in total * Speaker layout: 5.1 plus two back speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_7POINT1 = 0x63F, /** * Channel Layout For Octagonal, 8 channels in total * Speaker layout: 5.0 plus BL, BR and BC. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_OCTAGONAL = 0x737, /** * Channel Layout For 5.1.2, 8 channels in total * Speaker layout: 5.1 plus two top side speakers. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_5POINT1POINT2 = 0x300000060F, /** * Channel Layout For 7.1-Wide, 8 channels in total * Speaker layout: 5.1 plus left and right front center speakers. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_7POINT1_WIDE = 0x6CF, /** * Channel Layout For 7.1-Wide, 8 channels in total * Speaker layout: 5.1-Back plus left and right front center speakers. * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_7POINT1_WIDE_BACK = 0xFF, /** * Channel Layout For ORDER2-ACN-N3D Higher Order Ambisonics(HOA), 9 channels in total * Second order, ACN format, N3D * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER2_ACN_N3D = 0x100000000002, /** * Channel Layout For ORDER2-ACN-SN3D HOA, 9 channels in total * Second order, ACN format, SN3D * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER2_ACN_SN3D = 0x100000001002, /** * Channel Layout For ORDER2-FUMA HOA, 9 channels in total * Second order, FuMa format * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER2_FUMA = 0x100000000102, /** * Channel Layout For 5.1.4, 10 channels in total * Speaker layout: 5.1 plus four top speakers(TFL, TFR, TBL, TBR) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_5POINT1POINT4 = 0x2D60F, /** * Channel Layout For 7.1.2, 10 channels in total * Speaker layout: 7.1 plus two top side speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_7POINT1POINT2 = 0x300000063F, /** * Channel Layout For 7.1.4, 12 channels in total * Speaker layout: 7.1 plus four top speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_7POINT1POINT4 = 0x2D63F, /** * Channel Layout For 10.2, 12 channels in total * Speaker layout: FL, FR, FC, TFL, TFR, BL, BR, BC, SL, SR, wide left(WL), and wide right(WR) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_10POINT2 = 0x180005737, /** * Channel Layout For 9.1.4, 14 channels in total * Speaker layout: 7.1.4 plus two wide speakers(WL, WR) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_9POINT1POINT4 = 0x18002D63F, /** * Channel Layout For 9.1.6, 16 channels in total * Speaker layout: 9.1.4 plus two top side speakers * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_9POINT1POINT6 = 0x318002D63F, /** * Channel Layout For Hexadecagonal, 16 channels in total * Speaker layout: Octagonal plus two wide speakers, six top speakers(TFL, TFR, TFC, TBL, TBR, TBC) * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_HEXADECAGONAL = 0x18003F737, /** * Channel Layout For ORDER3-ACN-N3D HOA, 16 channels in total * Third order, ACN format, N3D * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER3_ACN_N3D = 0x100000000003, /** * Channel Layout For ORDER3-ACN-SN3D HOA, 16 channels in total * Third order, ACN format, N3D * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER3_ACN_SN3D = 0x100000001003, /** * Channel Layout For ORDER3-FUMA HOA, 16 channels in total * Third order, FuMa format * @syscap SystemCapability.Multimedia.Audio.Core * @since 11 */ CH_LAYOUT_AMB_ORDER3_FUMA = 0x100000000103 } } export default audio;