|
YAACC - UPNP Client and Server
|
The audio output on Android: a StreamingSink (all the logic, pure and tested) on an AudioTrack in streaming mode, 16 bit PCM, mono or stereo, written without blocking.
More...


Public Member Functions | |
| AudioTrackSink (MicroClock clock) | |
Public Member Functions inherited from de.yaacc.multiroom.engine.StreamingSink | |
| StreamingSink (MicroClock clock, Opener opener) | |
| void | open (SinkFormat wanted) throws AudioSinkException |
| Creates the output. | |
| void | attachTrace (EventTrace trace) |
| Lets the output note its own events (position source changes) in the engine's trace. | |
| int | startThresholdFrames () |
| How many frames the engine must have written before the output really starts playing (the streaming start threshold of the platform); 0 when the output starts at once. | |
| String | describe () |
| One line about the output for the status and the trace: buffer, start threshold, underruns, timestamp health. | |
| int | write (byte[] data, int offset, int length) throws AudioSinkException |
| Queues whole frames without blocking. | |
| void | start () throws AudioSinkException |
| Starts playback of what was written; does nothing when it already runs. | |
| void | flush () |
| Throws away everything queued and stops. | |
| PlaybackPosition | position () |
| The latest position the platform knows, or null when there is none (yet). | |
| int | underrunCount () |
| How often the output ran empty since it was opened. | |
| void | setGain (float gain) |
| A linear gain, 0 to 1. | |
| String | positionSource () |
A label of where position() comes from, for the status line. | |
| void | release () |
| Frees the output. | |
Public Member Functions inherited from de.yaacc.multiroom.engine.AudioSink | |
Additional Inherited Members | |
Static Public Attributes inherited from de.yaacc.multiroom.engine.StreamingSink | |
| static final int | WANTED_START_THRESHOLD_MS = 40 |
| The streaming start threshold the engine asks for: it wants the output to start early, with this much audio queued. | |
Static Package Attributes inherited from de.yaacc.multiroom.engine.StreamingSink | |
The audio output on Android: a StreamingSink (all the logic, pure and tested) on an AudioTrack in streaming mode, 16 bit PCM, mono or stereo, written without blocking.
This class is only the thin platform adapter.
Positions. AudioTrack.getTimestamp() gives a frame position (the low 32 bits, wrapping) and the time it is presented, on CLOCK_MONOTONIC (System.nanoTime()); StreamingSink converts it to the engine's clock by the age of the report.
Start threshold. A streaming track does not play after play() until the data path is filled to a minimum level (the whole buffer by default; Android 12 can lower it, setStartThresholdInFrames). The adapter lowers it where it can and tells the engine the level (startThresholdFrames()), which writes that much silence before it expects a position.
| de.yaacc.multiroom.engine.AudioTrackSink.AudioTrackSink | ( | MicroClock | clock | ) |
| clock | the clock of the engine (the one the connection's time sync uses) |