hi_mpi_ao_send_frame
Applicability
|
Product |
Supported |
|---|---|
|
|
☓ |
|
|
☓ |
|
|
√ |
|
|
☓ |
|
|
☓ |
Description
Sends AO audio frames.
Prototype
hi_s32 hi_mpi_ao_send_frame(hi_audio_dev ao_dev, hi_ao_chn ao_chn, const hi_audio_frame *data, hi_s32 milli_sec)
Parameters
|
Parameter |
Input/Output |
Description |
|---|---|---|
|
ao_dev |
Input |
Audio device ID. The value range is [0, 4]. |
|
ao_chn |
Input |
AO channel ID. |
|
data |
Input |
Audio frame structure. |
|
milli_sec |
Input |
Timeout interval for sending data (ms).
|
Returns
- 0: success
- Other values: failure. For details, see Audio Return Codes.
Restrictions
- This API is used to actively send audio frames to the AO channel.
- Before calling this API to send audio frames to the AO channel, call hi_mpi_ao_enable_chn to enable the corresponding AO channel.
- When the audio-left channel or stereo channel is used for playing, ai_chn must be fixed at 0. When the audio-right channel is used for recording, ai_chn is 1.
- The member variables len and virt_addr of the audio frame structure must match each other. len indicates the frame length (in bytes), and virt_addr indicates the address of the input audio data. It is recommended that the data transferred each time be a frame. That is, len equals point_num_per_frame multiplied by the bit width (2 bytes = 16 bits; 3 bytes = 24 bits).
- The limit on len: Calculate the number of data points based on len and the bit width (Number of data points = len/Number of bytes corresponding to the bit width). The range of the number of data points is [1, frame_num × point_num_per_frame], and the maximum value is 4096.
- Example 1: If frame_num = 2 and point_num_per_frame = 480 (for details about the range limit on frame_num and point_num_per_frame, see hi_aio_attr), frame_num × point_num_per_frame = 960. As 960 < 4096, the range of the number of data points is [1, 960].
- Example 2: If frame_num = 30 and point_num_per_frame = 4096, frame_num × point_num_per_frame = 122880. As 122880 > 4096, the range of the number of data points is [1, 4096].
- Example 3: When the range of data points determined based on frame_num and point_num_per_frame is [1, 960]: If len = 960 and the bit width is 16 bits (2 bytes), the calculated number of data points is 960/2 = 480. The value is within the range of [1, 960] and meets the requirement. If len = 3840 and the bit width is 16 bits (2 bytes), the calculated number of data points is 3840/2 = 1920. The value is beyond the range of [1, 960]and an error is reported.
Parent topic: AI/AO