#include <cafe/mic.h>

int MICOpen(mic_handle_t h_mic);


h_mic Handle returned from MICInit.

Return Values

A value of MIC_ERROR_NONE (zero) 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 MICOpen is called before MICInit. MIC_ERROR_ALREADY_OPEN is returned if MICOpen has been called before with out disconnect, close, or foreground background switch having occurred. MIC_ERROR_NOT_CONNECTED is returned if the DRC has become disconnected from the console.


Calling this function will start the streaming of audio data from the selected DRC's microphone. Streaming continues until MICClose is called, the DRC becomes disconnected from the console, a foreground background switch occurred, or MICUninit is called.

If streaming was stopped with MICClose then it can be restarted by calling MICOpen.

The DRC microphone library implements rate matching and zero fill algorithms that assure that no data starvation or overflow will occur for as long as the DRC is connected, the application is in the foreground, and the device is not closed. That keeps the incoming data rate at exactly 32000 samples per second. However, the levels within the ring buffer can fluctuate by as much as 800 samples, corresponding to 25ms. The nominal, long term drift is not allowed to exceed 128 samples. That keeps the latency within 4ms of the latency initially set by the application. It is important that the initial latency and ring buffer size are sufficient to accommodate such level fluctuations without underflowing or overflowing the 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 ensure that a sufficient number of new audio samples are in the shared ring buffer a caller must call MICGetStatus to query that a sufficient number of audio samples is present.

MICOpen is a synchronous call and will take several milliseconds to execute, although much of the time is spent waiting on synchronization objects. This function is not meant to be called from timing sensitive threads.

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/06/08 Update to match SDK 2.06.
2011/10/27 Initial version.