• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Types
2
3> **NOTE**
4>
5> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
6
7## AudioRendererChangeInfoArray<sup>9+</sup>
8
9type AudioRendererChangeInfoArray = Array&lt;Readonly&lt;AudioRendererChangeInfo&gt;&gt;
10
11Defines an AudioRenderChangeInfo array, which is read-only.
12
13**System capability**: SystemCapability.Multimedia.Audio.Renderer
14
15| Type     | Description                                                           |
16|---------|---------------------------------------------------------------|
17| Array&lt;Readonly&lt;AudioRendererChangeInfo&gt;&gt; | An [AudioRendererChangeInfo](arkts-apis-audio-i.md#audiorendererchangeinfo9) array, which is read-only.|
18
19
20## AudioCapturerChangeInfoArray<sup>9+</sup>
21
22type AudioCapturerChangeInfoArray = Array&lt;Readonly&lt;AudioCapturerChangeInfo&gt;&gt;
23
24Defines an AudioCapturerChangeInfo array, which is read-only.
25
26**System capability**: SystemCapability.Multimedia.Audio.Capturer
27
28| Type     | Description                                                             |
29|---------|-----------------------------------------------------------------|
30| Array&lt;Readonly&lt;AudioCapturerChangeInfo&gt;&gt; | An [AudioCapturerChangeInfo](arkts-apis-audio-i.md#audiocapturerchangeinfo9) array, which is read-only.|
31
32
33## AudioEffectInfoArray<sup>10+</sup>
34
35type AudioEffectInfoArray = Array&lt;Readonly&lt;AudioEffectMode&gt;&gt;
36
37Defines an array that contains the audio effect mode corresponding to a specific audio content type (specified by **ContentType**) and audio stream usage (specified by **StreamUsage**). The [AudioEffectMode](arkts-apis-audio-e.md#audioeffectmode10) array is read-only.
38
39**System capability**: SystemCapability.Multimedia.Audio.Renderer
40
41| Type     | Description                                                           |
42|---------|---------------------------------------------------------------|
43| Array&lt;Readonly&lt;AudioEffectMode&gt;&gt; | Defines an array that contains the audio effect mode corresponding to a specific audio content type (specified by **ContentType**) and audio stream usage (specified by **StreamUsage**). The [AudioEffectMode](arkts-apis-audio-e.md#audioeffectmode10) array is read-only.|
44
45## AudioDeviceDescriptors
46
47type AudioDeviceDescriptors = Array&lt;Readonly&lt;AudioDeviceDescriptor&gt;&gt;
48
49Defines an [AudioDeviceDescriptor](arkts-apis-audio-i.md#audiodevicedescriptor) array, which is read-only.
50
51**Atomic service API**: This API can be used in atomic services since API version 12.
52
53**System capability**: SystemCapability.Multimedia.Audio.Device
54
55| Type     | Description                                                           |
56|---------|---------------------------------------------------------------|
57| Array&lt;Readonly&lt;AudioDeviceDescriptor&gt;&gt; | Defines an [AudioDeviceDescriptor](arkts-apis-audio-i.md#audiodevicedescriptor) array, which is read-only.|
58
59
60## AudioRendererWriteDataCallback<sup>12+</sup>
61
62type AudioRendererWriteDataCallback = (data: ArrayBuffer) => AudioDataCallbackResult | void
63
64Defines the callback function used to write data to the audio renderer. Once the callback function finishes its execution, the audio service queues the data pointed to by **data** for playback. Therefore, do not change the data outside the callback. It is crucial to fill **data** with the exact length of data designated for playback; otherwise, noises may occur during playback.
65
66**System capability**: SystemCapability.Multimedia.Audio.Renderer
67
68**Parameters**
69
70| Name         | Type     |Mandatory  | Description        |
71| :--------------| :--------| :----- | :------------ |
72| data           | ArrayBuffer  | Yes| Data to be written to the buffer.|
73
74**Return value**
75
76| Type                                                          | Description                                                                                                         |
77|--------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|
78| [AudioDataCallbackResult](arkts-apis-audio-e.md#audiodatacallbackresult12) \| void | If **void** or **AudioDataCallbackResult.VALID** is returned, the data is valid and the audio data is played. If **AudioDataCallbackResult.INVALID** is returned, the data is invalid and the audio data is not played.|
79