Oboe
A library for creating real-time audio apps on Android
|
#include <AudioStreamCallback.h>
Public Member Functions | |
virtual bool | onError (AudioStream *, Result) |
virtual void | onErrorBeforeClose (AudioStream *, Result) |
virtual void | onErrorAfterClose (AudioStream *, Result) |
AudioStreamErrorCallback defines a callback interface for being alerted when a stream has an error or is disconnected using onError*
methods.
Note: This callback is only fired when an AudioStreamCallback is set. If you use AudioStream::write() you have to evaluate the return codes of AudioStream::write() to notice errors in the stream.
It is used with AudioStreamBuilder::setErrorCallback().
|
inlinevirtual |
This will be called before other onError
methods when an error occurs on a stream, such as when the stream is disconnected.
It can be used to override and customize the normal error processing. Use of this method is considered an advanced technique. It might, for example, be used if an app want to use a high level lock when closing and reopening a stream. Or it might be used when an app want to signal a management thread that handles all of the stream state.
If this method returns false it indicates that the stream has *not been stopped and closed by the application. In this case it will be stopped by Oboe in the following way: onErrorBeforeClose() will be called, then the stream will be closed and onErrorAfterClose() will be closed.
If this method returns true it indicates that the stream has been stopped and closed by the application and Oboe will not do this. In that case, the app MUST stop() and close() the stream.
This method will be called on a thread created by Oboe.
audioStream | pointer to the associated stream |
error |
|
inlinevirtual |
This will be called when an error occurs on a stream, such as when the stream is disconnected, and if onError() returns false (indicating that the error has not already been handled).
The underlying AAudio or OpenSL ES stream will already be stopped AND closed by Oboe. So the underlying stream cannot be referenced. But you can still query most parameters.
This callback could be used to reopen a new stream on another device.
audioStream | pointer to the associated stream |
error |
Reimplemented in oboe::StabilizedCallback.
|
inlinevirtual |
This will be called when an error occurs on a stream, such as when the stream is disconnected, and if onError() returns false (indicating that the error has not already been handled).
Note that this will be called on a thread created by Oboe.
The underlying stream will already be stopped by Oboe but not yet closed. So the stream can be queried.
Do not close or delete the stream in this method because it will be closed after this method returns.
audioStream | pointer to the associated stream |
error |
Reimplemented in oboe::StabilizedCallback.