YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.sendspin.player.SendspinAudioEngine Class Reference

Plays the stream of a Sendspin server with the engine that already plays a Snapcast stream in sync (ClientEngine: exact start, drift correction by dropping or repeating single frames, the output's own position reports). More...

Inheritance diagram for de.yaacc.sendspin.player.SendspinAudioEngine:
Inheritance graph
Collaboration diagram for de.yaacc.sendspin.player.SendspinAudioEngine:
Collaboration graph

Classes

interface  Target
 What the engine side takes; the production one is an EngineHost, the tests drive the engine by hand. More...
 

Public Member Functions

 SendspinAudioEngine (Target target)
 
void start (String codec, int sampleRate, int channels, int bitDepth, byte[] codecHeader)
 A stream starts in this format (the session checked that it is one the player offered; codecHeader is null for PCM).
 
void chunk (long serverTimestampMicros, byte[] pcm)
 One chunk: the audio and the time it has to be heard, on the server's clock.
 
void clear (Long fromTimestamp)
 Drops what is buffered (fromTimestamp: only what is stamped later; null: everything).
 
void end ()
 The stream ends (a pause or a stop): what is buffered is dropped.
 
void setVolume (int percent)
 
void setMuted (boolean mute)
 
void setOutputDelayMs (int milliseconds)
 The delay of the output beyond the audio port (a Bluetooth speaker): the engine plays this much earlier.
 
int volume ()
 
boolean muted ()
 
- Public Member Functions inherited from de.yaacc.sendspin.client.PlayerSession.Audio

Static Public Member Functions

static Target onHost (final EngineHost host)
 A target that runs on the engine thread of an EngineHost.
 
static Target direct (final ClientEngine engine)
 A target that calls the engine itself (tests, and a caller that is the engine's one thread).
 

Detailed Description

Plays the stream of a Sendspin server with the engine that already plays a Snapcast stream in sync (ClientEngine: exact start, drift correction by dropping or repeating single frames, the output's own position reports).

This class only translates: a Sendspin stream start is a PCM header, a chunk's timestamp is the time it must be heard on the server's clock (the Snapcast "buffer" is 0, so the engine plays it at timestamp - offset), volume and mute are the settings, the output delay of the player is the manual latency, and a stream/clear or stream/end is a flush of the engine (the header is sent again to go on after a clear). The offset of the clock is the session's.

Member Function Documentation

◆ chunk()

void de.yaacc.sendspin.player.SendspinAudioEngine.chunk ( long serverTimestampMicros,
byte[] pcm )

One chunk: the audio and the time it has to be heard, on the server's clock.

Implements de.yaacc.sendspin.client.PlayerSession.Audio.

Referenced by de.yaacc.sendspin.player.SendspinAudioEngine.direct(), and de.yaacc.sendspin.player.SendspinAudioEngine.onHost().

Here is the caller graph for this function:

◆ clear()

void de.yaacc.sendspin.player.SendspinAudioEngine.clear ( Long fromTimestamp)

Drops what is buffered (fromTimestamp: only what is stamped later; null: everything).

Implements de.yaacc.sendspin.client.PlayerSession.Audio.

◆ end()

void de.yaacc.sendspin.player.SendspinAudioEngine.end ( )

The stream ends (a pause or a stop): what is buffered is dropped.

Implements de.yaacc.sendspin.client.PlayerSession.Audio.

◆ start()

void de.yaacc.sendspin.player.SendspinAudioEngine.start ( String codec,
int sampleRate,
int channels,
int bitDepth,
byte[] codecHeader )

A stream starts in this format (the session checked that it is one the player offered; codecHeader is null for PCM).

Exceptions
IllegalArgumentExceptionif the codec header is not one the player can play (the session ends)

Implements de.yaacc.sendspin.client.PlayerSession.Audio.

Here is the call graph for this function:

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