#include <cafe/usb_mic.h> int USBMICInit(void* pv_cx, usb_event_handler_t pfn_event);
|pv_cx||Pointer to an application provided context that is the first argument in the event callback.|
A function pointer to the application's UAC event handler of type
A value of zero indicates success and any other value the type of error that was encountered.
This function is called once to initialize the UAC stack and to register an event callback function. Subsequent events, attach, detach, error, are sent from the UAC stack to the application via this callback.
Call this function once per instance of the UAC library and driver stack. The same event handler is called for all events of all devices.
A separate thread in the UAC stack services the event handler. You may put synchronization objects into the event handler, such as a mutex. However, care must be taken to ensure that a deadlock does not occur.
The UAC API set is designed to be called from within the event handler, with the exception of
The event handler is called for every attach, detach, or error event. Because the number of microphones that are supported simultaneously is limited to two, no indications are sent if additional microphones are attached and removed.
In the event that a foreground to background switch occurs, the entire UAC stack is shut down and left in a quiescent state. Upon reacquiring the foreground, the application must reinitialize the entire UAC stack and call this function again. For more information about foreground and background switching, and how to handle the required processing, see USB Microphone Library Overview.
This function requires ten milliseconds to complete, with much of that time spent waiting on synchronization objects. It is recommended that you DO NOT call this function from a timing sensitive thread.
|Background||Do not call this function from the background.|
|Multiple threads||This function is not thread-safe.|
|Callbacks||Do not call this function from any callback function.|
|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/07/05 Update for SDK2.06
2012/01/05 Initial version.