#include <cafe/uac.h>

int UACINSetDataConsumed(usb_mic_handle_t h_mic, unsigned int c_samples);


h_mic Instance handle returned via usb_event_data_t data structure through the event handler of type usb_event_handler_t that is provided as an argument to UACInit and will contain a valid instance handle when the UAC device is attached.
c_samples The number of PCM samples (16-bit signed integer) that the application has taken from the ring buffer. One sample consists of the interleaved set of PCM data for all channels.

Return Values

A value of zero indicates success and any other value the type of error that was encountered.


Calling this function will update the ring buffer state in the UAC library. The count is in samples, not bytes. One sample is sizeof(short int) * <number-of-channels>. Since this function will only update the internal state in the library, it does not matter whether the data were copied or DMA'ed.

Because this function serves the purpose of keeping track of the ring buffer state in the UAC library, it is permissible to consume more data than are available. Although that constitutes a ring buffer underflow, there are circumstances under which this can happen and coherent state needs to be preserved in those cases.

This function is designed to be callable from a timing sensitive thread such as an AX callback function.

The rate of data generation is designed to match the rate of consumption of the AX system exactly. A rate matching algorithm is in place to compensate for clock drift, if any, between the input device and the nominal sample rate of 32kHz.

Do Not Call From

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.

See Also

Error Codes

Revision History

2013-05-29 Initial version.