hi_mpi_ao_send_frame
Applicability
|
Product |
Supported |
|---|---|
|
Atlas 350 Accelerator Card |
☓ |
|
|
☓ |
|
|
☓ |
|
|
√ |
|
|
☓ |
|
|
☓ |
Function 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 MPI is used to send audio frames to the AO module.
- Before calling this MPI to send audio frames to the AO channel, you must call the hi_mpi_ao_enable_chn MPI 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 length len is limited as follows: First, a quantity of data points is calculated based on len and a bit width (quantity of data points = len/quantity of bytes corresponding to the bit width). A range of the quantity of data points is [1, frame_num * point_num_per_frame], and a maximum upper limit is 4096.
- Example 1: If frame_num=2, point_num_per_frame=480 (for details about the range restrictions of frame_num and point_num_per_frame, see the structure hi_aio_attr), frame_num * point_num_per_frame=960, and 960<4096, the range of the number of data points is [1, 960].
- Example 2: If If frame_num = 30 and point_num_per_frame = 4096, frame_num x 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