hi_mpi_ai_get_frame

The Atlas 200/300/500 Inference Product does not support this API.

The Atlas Training Series Product does not support this API.

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).

  • -1: blocking mode. The wait is infinite if there is no data.
  • 0: non-blocking mode. An error is returned if there is no data.
  • > 0: A specific timeout interval needs to be configured. If no data is found after the specified interval, an error is returned.

Returns