AAudioStreamBuilder_setErrorCallback

Function AAudioStreamBuilder_setErrorCallback 

Source
pub unsafe extern "C" fn AAudioStreamBuilder_setErrorCallback(
    builder: *mut AAudioStreamBuilder,
    callback: ErrorCallback,
    user_data: *mut c_void,
)
Expand description

Request that AAudio call this function if any error occurs or the stream is disconnected.

It will be called, for example, if a headset or a USB device is unplugged causing the stream’s device to be unavailable or “disconnected”. Another possible cause of error would be a timeout or an unanticipated internal error.

In response, this function should signal or create another thread to stop and close this stream. The other thread could then reopen a stream on another device. Do not stop or close the stream, or reopen the new stream, directly from this callback.

This callback will not be called because of actions by the application, such as stopping or closing a stream.

Note that the AAudio callbacks will never be called simultaneously from multiple threads.

Available since API level 26.

§Arguments

  • builder - reference provided by AAudio_createStreamBuilder()
  • callback - pointer to a function that will be called if an error occurs.
  • user_data - pointer to an application data structure that will be passed to the callback functions.