#include <cafe/mic.h>

int MICSetState(mic_handle_t h_mic, mic_state_t state, unsigned int value);


h_mic Handle returned from MICInit.
state An enumerated type specifying which value to program.
value Value to be programmed, cast as unsigned int.

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 function is called before MICInit or after MICClose. MIC_ERROR_NOT_SUP is returned when setting the quantity specified in state is not supported.


This function is used to program microphone specific values. For example, this function is used to set the current gain.

This function will only work when the device is open, i.e., following MICOpen and when audio streaming is in progress. When that is not the case, an error is returned. An application can retry an operation any number of times if an error was returned and the error was due to the streaming state of the microphone data pipeline.
The opening of the data pipeline and the device being ready to accept state values are not strictly synchronized. If it is desirable to retrieve or program state values immediately after opening the device, then it is recommended to place such logic in a loop that will retry the sequence of necessary operations until they succeed or the number of retries is exhausted.

For the microphone gain programming sequence, see MICGetState.

MICSetState is a synchronous call and, depending on the quantity to get, will take from a few to over one hundred 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/08/03 Cleanup Pass.
2012/06/08 Update to match SDK 2.06.
2011/12/22 Initial version.