YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.multiroom.engine.StreamingSink Class Reference

The audio output of the engine on top of a TrackPort: everything that is logic and not a platform call. More...

Inheritance diagram for de.yaacc.multiroom.engine.StreamingSink:
Inheritance graph
Collaboration diagram for de.yaacc.multiroom.engine.StreamingSink:
Collaboration graph

Classes

interface  Opener
 Opens the platform output. More...
 

Public Member Functions

 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

Static Public Attributes

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.
 

Detailed Description

The audio output of the engine on top of a TrackPort: everything that is logic and not a platform call.

It keeps the position bookkeeping (the 32 bit counters are unwrapped, a timestamp older than the last flush is ignored, the position after a flush is taken from zero), converts the platform's monotonic time to the engine clock by the age of a report, and falls back to the head position when the platform gives no timestamp.

Constructor & Destructor Documentation

◆ StreamingSink()

de.yaacc.multiroom.engine.StreamingSink.StreamingSink ( MicroClock clock,
Opener opener )
Parameters
clockthe clock of the engine (the one the connection's time sync uses)

Member Function Documentation

◆ attachTrace()

void de.yaacc.multiroom.engine.StreamingSink.attachTrace ( EventTrace trace)

Lets the output note its own events (position source changes) in the engine's trace.

Implements de.yaacc.multiroom.engine.AudioSink.

◆ describe()

String de.yaacc.multiroom.engine.StreamingSink.describe ( )

One line about the output for the status and the trace: buffer, start threshold, underruns, timestamp health.

Implements de.yaacc.multiroom.engine.AudioSink.

Here is the call graph for this function:

◆ flush()

void de.yaacc.multiroom.engine.StreamingSink.flush ( )

Throws away everything queued and stops.

The counting of PlaybackPosition#getFrames() starts again at 0 and start() is needed again. The output itself is kept (it is not re-created).

Implements de.yaacc.multiroom.engine.AudioSink.

Here is the call graph for this function:

◆ open()

void de.yaacc.multiroom.engine.StreamingSink.open ( SinkFormat format) throws AudioSinkException

Creates the output.

Not started yet.

Implements de.yaacc.multiroom.engine.AudioSink.

Here is the call graph for this function:

◆ position()

PlaybackPosition de.yaacc.multiroom.engine.StreamingSink.position ( )

The latest position the platform knows, or null when there is none (yet).

Implements de.yaacc.multiroom.engine.AudioSink.

Referenced by de.yaacc.multiroom.engine.StreamingSink.position().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ positionSource()

String de.yaacc.multiroom.engine.StreamingSink.positionSource ( )

A label of where position() comes from, for the status line.

Implements de.yaacc.multiroom.engine.AudioSink.

Referenced by de.yaacc.multiroom.engine.StreamingSink.describe().

Here is the caller graph for this function:

◆ release()

void de.yaacc.multiroom.engine.StreamingSink.release ( )

Frees the output.

Safe to call twice.

Implements de.yaacc.multiroom.engine.AudioSink.

Referenced by de.yaacc.multiroom.engine.StreamingSink.open().

Here is the caller graph for this function:

◆ setGain()

void de.yaacc.multiroom.engine.StreamingSink.setGain ( float gain)

A linear gain, 0 to 1.

Implements de.yaacc.multiroom.engine.AudioSink.

◆ start()

void de.yaacc.multiroom.engine.StreamingSink.start ( ) throws AudioSinkException

Starts playback of what was written; does nothing when it already runs.

Implements de.yaacc.multiroom.engine.AudioSink.

◆ startThresholdFrames()

int de.yaacc.multiroom.engine.StreamingSink.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.

Implements de.yaacc.multiroom.engine.AudioSink.

Here is the call graph for this function:

◆ underrunCount()

int de.yaacc.multiroom.engine.StreamingSink.underrunCount ( )

How often the output ran empty since it was opened.

Implements de.yaacc.multiroom.engine.AudioSink.

◆ write()

int de.yaacc.multiroom.engine.StreamingSink.write ( byte[] data,
int offset,
int length ) throws AudioSinkException

Queues whole frames without blocking.

Returns
the number of bytes taken, a multiple of the frame size; 0 when the output is full

Implements de.yaacc.multiroom.engine.AudioSink.

Here is the call graph for this function:

The documentation for this class was generated from the following file: