#include <cafe/usb_mic.h>

int USBMICStart(usb_mic_handle_t h_mic);


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 USBMICInit and will contain a valid instance handle when the USB microphone is attached.

Return Values

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


Calling this function will start the streaming of PCM data into the ring buffer that was provided to the USB UAC stack with USBMICOpen until USBMICStop is called. This function will only succeed if the USB UAC stack has been successfully opened via USBMICOpen.

This function can be called from the event handler that was provided with USBMICInit.
If the UAC device stops sending audio data for any reason no data will be placed in the shared ring buffer. However, as soon as the UAC device returns to being ready, more PCM audio data will be placed into the shared ring buffer.

If, for some reason, the caller of this function cannot keep up with the rate of inflowing data, then the oldest audio samples in the ring buffer will be overwritten.

To assure that a sufficient number of audio samples are in the shared ring buffer, a caller must call USBMICGetStatus to query that a sufficient number of audio samples are present.

This function is affected by foreground/background switching. Upon releasing foreground, an application is required to call USBMICStop, USBMICClose, and USBMICUninit to fully shut down the UAC driver stack. When foreground status is reacquired, an application needs to go through the sequence of USBMICInit and device discovery again.

In the event an application does perform the series of steps outlined above, the library will perform the equivalent sequence. After an application and associated RPLs release foreground, all underlying drivers and hardware are quiescent.

This function requires several milliseconds to complete, although much of that time is spent waiting on synchronization objects. It is not recommended to call this function from a timing sensitive thread.

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/08 Automated cleanup pass.
2012/08/03 Cleanup Pass
2012/07/09 Update for SDK2.06
2012/01/04 Initial version.