UACOUTStart

Syntax

#include <cafe/uac.h>

int UACOUTStart(usb_mic_handle_t h_mic, usb_mic_ringbuffer_t* p_rb,
                unsigned int sample_rate);

Parameters

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.
p_rb A pointer to a ring buffer of type usb_mic_ringbuffer_t from which data will be streamed.
sample_rate Either UAC_SAMPLE_RATE_32K or UAC_SAMPLE_RATE_48K, as defined in usb_event_handler_t

Return Values

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

Description

Calling this function will start the streaming of interleaved PCM data from the ring buffer that was provided with this function call until UACOUTStop is called. This function will only succeed if the UAC stack has been successfully opened via UACOpen.

NOTE:
This function can be called from the event handler that was provided with UACInit.

If, for some reason, the caller of this function cannot keep up with the rate of outflowing data, then a stream of zeros is sent to the UAC output interface.

To assure that a sufficient free space exists in the output ring buffer, a caller must call UACOUTGetStatus to query how many PCM samples can be placed into the ring buffer.

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

In the event an application does not 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

UACInit
UACUninit
UACOpen
UACOUTStop
UACOUTGetStatus
usb_event_handler_t
usb_mic_handle_t
Error Codes

Revision History

2013/05/29 Initial version.


CONFIDENTIAL