hi_mpi_ai_get_frame
The
The
Description
Obtains audio frames.
Restrictions
- Enable the corresponding AI device by calling hi_mpi_ai_enable before obtaining audio frame data.
- When the audio-left channel or stereo channel is used for recording, ai_chn must be fixed at 0. When the audio-right channel is used for recording, ai_chn is 1.
- This API and hi_mpi_ai_release_frame must be used in pairs. Call this API to obtain audio frames and after the audio frames are used, call hi_mpi_ai_release_frame to release the buffer for storing audio frames in time.
Prototype
hi_s32 hi_mpi_ai_get_frame(hi_audio_dev ai_dev, hi_ai_chn ai_chn, hi_audio_frame *frame, hi_aec_frame *aec_frame, hi_s32 milli_sec);
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
ai_dev |
Input |
Audio device ID. The value range is [0, 2]. |
ai_chn |
Input |
AI channel ID. |
frame |
Output |
Pointer to the structure of the audio frame. |
aec_frame |
Output |
Pointer to the structure of the reference frame for echo cancellation. This parameter is reserved. Currently, it is set to NULL. |
milli_sec |
Input |
Timeout interval for obtaining data (ms).
|
Returns
- 0: success
- Other values: failure. For details, see Audio Return Codes.
Parent topic: AI/AO