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

The audio output as the engine sees it (an AudioTrack in streaming mode on Android, a simulation in tests). More...

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

Public Member Functions

void open (SinkFormat format) throws AudioSinkException
 Creates the output.
 
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.
 
default 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.
 
default void attachTrace (EventTrace trace)
 Lets the output note its own events (position source changes) in the engine's trace.
 
default String describe ()
 One line about the output (buffer, threshold, timestamp health) for the status and the trace.
 
String positionSource ()
 A label of where position() comes from, for the status line.
 
void release ()
 Frees the output.
 

Detailed Description

The audio output as the engine sees it (an AudioTrack in streaming mode on Android, a simulation in tests).

It is used from the engine's thread only. Frames are 16 bit interleaved PCM in the byte order of the platform.

Member Function Documentation

◆ attachTrace()

default void de.yaacc.multiroom.engine.AudioSink.attachTrace ( EventTrace trace)

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

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ describe()

default String de.yaacc.multiroom.engine.AudioSink.describe ( )

One line about the output (buffer, threshold, timestamp health) for the status and the trace.

Implemented in de.yaacc.multiroom.engine.StreamingSink.

Referenced by de.yaacc.multiroom.engine.ClientEngine.status().

Here is the caller graph for this function:

◆ flush()

void de.yaacc.multiroom.engine.AudioSink.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).

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ open()

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

Creates the output.

Not started yet.

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ position()

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

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

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ positionSource()

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

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

Implemented in de.yaacc.multiroom.engine.StreamingSink.

Referenced by de.yaacc.multiroom.engine.ClientEngine.status().

Here is the caller graph for this function:

◆ release()

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

Frees the output.

Safe to call twice.

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ setGain()

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

A linear gain, 0 to 1.

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ start()

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

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

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ startThresholdFrames()

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

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ underrunCount()

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

How often the output ran empty since it was opened.

Implemented in de.yaacc.multiroom.engine.StreamingSink.

◆ write()

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

Implemented in de.yaacc.multiroom.engine.StreamingSink.


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