#include <cafe/mic.h> int MICSetDataConsumed(mic_handle_t h_mic, unsigned int c_samples);
|h_mic||Handle returned from
|c_samples||The number of audio samples of type
A value of
0) indicates success and any other value indicates the type of error that was encountered.
MIC_ERROR_INV_ARG is returned if an invalid handle is passed in.
MIC_ERROR_NOT_INIT is returned when the function is called before
MICInit or after
-81 is returned if the ring buffer underflows as a result of updating its state.
This function is used to keep the shared ring buffer state coherent between the microphone driver and the sink, i.e., the consumer of the audio samples. The AX system in Cafe is capable of playing back the DRC microphone's PCM data stream directly out of the shared ring buffer without any further data copies. This function is used to keep the finite state machine in the microphone driver up to date with the actual data consumption.
It is permissible to consume more data than are available in the ring buffer. All arithmetic is performed 'modulo
ring buffer size'. That means that after consuming more data than available,
MICGetStatus will indicate that
samples are available although the ring buffer had underflowed. An underflow is indicated by an unnamed
return value of
The ring buffer state update is performed even when an underflow occurred. The PCM data can be played back with a free running finite state machine and there can be corner cases under which a buffer underflow might happen.
The processing performed in
MICSetDataConumed is lightweight and calling this function
from a timing sensitive thread, such as the AX callback, can be performed.
|Background||Do not call this function from the background.|
|Interrupt handler||Do not call this function from any interrupt handler.|
|Exception handler||Do not call this function from any exception handler.|
2013/05/08 Automated cleanup pass.
2012/08/03 Cleanup Pass.
2012/06/08 Update to match SDK 2.06.
2011/10/27 Initial version.