pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AudioEngine Class Reference

Audio engine, responsible for one "room" worth of audio. More...

#include <engine.h>

Inheritance diagram for AudioEngine:
Inheritance graph
[legend]
Collaboration diagram for AudioEngine:
Collaboration graph
[legend]

Public Member Functions

virtual void registerInterpreter (PianodDispatcher &dispatcher) override
 Register the interpreter with a dispatcher. More...
 
virtual const Parsnip::Parser::DefinitionsgetParserDefinitions () override
 Retrieve the parser definitions handled by the interpreter. More...
 
 AudioEngine (PianodService *svc, const AudioSettings &audio_options)
 Create a new audio player attached to a service with an assigned audio output device. More...
 
virtual ~AudioEngine (void)
 
void shutdown (bool immediate)
 Initiate shutdown of the audio engine. More...
 
float periodic (void)
 Periodically invoked function that monitors players, starts new songs, etc. More...
 
ResponseGroup assembleStatus ()
 Should be called intermittently by the main run-loop. More...
 
ResponseGroup updateStatus (PianodConnection &there)
 Update audio engine status to a client. More...
 
void usersChangedNotification ()
 
UserList getAutotuneUsers ()
 
const AudioSettingsaudioSettings ()
 
- Public Member Functions inherited from PianodInterpreter
const HelpList getHelp (const std::vector< std::string > &search, std::set< std::string > *option_parsers)
 Search the interpreter's definitions for any definitions matching search criteria. More...
 

Static Public Member Functions

static const Parsnip::OptionParser::Definitionsplayback_selection_option_definitions ()
 
static const Parsnip::Parser::Definitionsparser_definitions ()
 
static const PianodSchema::CommandIdsjson_request_names ()
 Retrieve names for our JSON requests. More...
 
- Static Public Member Functions inherited from PianodInterpreter
static bool optionIs (const Parsnip::Data &options, const char *name, const char *expected)
 Check if a string value exists and is case-blind equal to a particular value. More...
 
template<typename ValueType , typename LookupType >
static ValueType optionalValue (const Parsnip::Data &options, const char *name, const LookupType &lookup, const ValueType default_value)
 Retrieve the ID of a string value. More...
 

Private Types

enum  requirement_t { REQUIRE_SOURCE = 0x01 , REQUIRE_PLAYLIST = 0x02 , REQUIRE_PLAYER = 0x04 , REQUIRE_EXPAND = 0x10 }
 Prerequisites that may be necessary to execute a particular command. More...
 
enum class  PlaybackState { PAUSED , PLAYING }
 
enum class  TransitionProgress {
  Playing , Purged , Cueing , Crossfading ,
  Done
}
 States player progresses through when segueing between tracks. More...
 
enum class  QueueMode { STOPPED , REQUESTS , RANDOMPLAY }
 Behaviors possible when the player is idle. More...
 
enum class  Announced { NEVER , PARTIALLY , COMPLETELY }
 Whether and how completely track information was announced at start of playback. More...
 
typedef enum AudioEngine::requirement_t REQUIREMENT
 Prerequisites that may be necessary to execute a particular command. More...
 

Private Member Functions

virtual bool authorizedCommand (Parsnip::Parser::CommandId command, PianodConnection &conn) override
 Check whether a command is authorized. More...
 
virtual ResponseCollector handleCommand (Parsnip::Parser::CommandId command, const Parsnip::Data &options, PianodConnection &conn) override
 Command handler. More...
 
MusicThingiegetThingOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, Ownership::Action usage=Ownership::Action::USE) const
 Get a thing from a predicate and ensure it is usable. More...
 
MusicThingiegetThingOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, MusicThingie::Type want, Ownership::Action usage=Ownership::Action::USE) const
 Get a thing from a predicate, ensure usability and it conforms to a type. More...
 
ThingieList getThingsOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, CommandReply *diagnostics, Ownership::Action usage=Ownership::Action::USE) const
 Get some things from a predicate and ensure they is usable. More...
 
ThingieList getThingsOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, MusicThingie::Type want, CommandReply *diagnostics, Ownership::Action usage=Ownership::Action::USE) const
 Get things from a predicate, ensure usability and it conforms to a type. More...
 
SongList getSongsOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, CommandReply *diagnostics, Ownership::Action usage=Ownership::Action::USE) const
 Get a songlist predicate, or use current song. More...
 
PianodPlaylistgetPlaylistOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, Ownership::Action usage) const
 Get a playlist predicate, or use current playlist. More...
 
PlaylistList getPlaylistsOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, CommandReply *diagnostics, Ownership::Action usage=Ownership::Action::USE) const
 Get a playlist predicate, or use current playlist. More...
 
PlaylistList getPlaylistsOrCurrent (const PianodConnection &conn, const Parsnip::Data &options, CommandReply *diagnostics, Ownership::Action usage, const ThingieList &default_playlist) const
 Get a playlist predicate, or use one implied by a thing. More...
 
void require (PianodConnection &conn, unsigned long requirements) const
 Check that required state/privileges are available. More...
 
CommandReply controlPlayback (const Parsnip::Data &options, bool start_playback, PianodConnection &conn)
 
bool queueEmpty (void) const
 
bool startPlayer (void)
 Start playback of a the next song in the queue. More...
 
ResponseGroup promotePlayer (void)
 Promote the cueing player to the primary player. *‍/. More...
 
ResponseGroup cleanupPlayer (void)
 Clean up when a player completes. More...
 
float monitorPlayer (void)
 Check/respond to various things with the player. More...
 
ResponseGroup playbackState (PlaybackState state, PianodConnection *conn=nullptr)
 Pause or resume playback. More...
 
ResponseGroup queueMode (QueueMode mode, PianodConnection *conn=nullptr)
 Set the queueing mode. More...
 
bool gatherPlaybackStatus (ResponseGroup *response, bool only_if_accurate=false) const
 
ResponseGroup gatherPlaybackStatus () const
 
Response gatherQueueMode () const
 
Response gatherSelectedPlaylist () const
 
SongList sendSongLists (PianodConnection &conn, const Parsnip::Data &options, bool historical)
 Generate response messages. More...
 
void PurgeUnselectedSongs (void)
 Remove songs from the front of the random queue (but not songs from the request queue). More...
 
bool considerCreatingPlayer (void)
 Create a player, if the current state allows it. More...
 
bool acquireRandomTracks (void)
 Retrieves some random tracks and puts them in the queue. More...
 
void sourceReady (const Media::Source *const)
 When a new source is ready, clear any track aquisition delays. More...
 
bool sourceRemovalCheck (const Media::Source *const source)
 Remove all songs from a given source. More...
 
void sourceRemoved (const Media::Source *const source)
 Unregister a source by removing its playlists. More...
 
void sourceOffline (const Media::Source *const)
 Unregister a source by removing its playlists. More...
 
void sourceStatus (RESPONSE_CODE status, const char *detail)
 Transmit any source status notifications to connected clients. More...
 
void playlistsChanged ()
 When playlists have changed, reset track aquisition lockouts. More...
 
void mixChanged (bool automatic, const char *why)
 When mix has changed, reset track aquisition lockouts. More...
 

Static Private Member Functions

static DataResponse constructSeedlist (const ThingieList &things, PianodPlaylist *playlist)
 Prepare a list of seeds for transmission. More...
 

Private Attributes

struct {
   time_t   playback_effective_start = 0
 When not stalled, current time minus playback point. More...
 
   time_t   onset = 0
 Clock time at which a playback stall was detected. More...
 
   time_t   onset_playpoint = 0
 Playback point at which a playback stall was detected. More...
 
stall
 Structure used to track player progress/status. More...
 
const float prefetch_time = 5
 Number of seconds before cuing at which queue is refreshed. More...
 
SongList::size_type history_size = 10
 Maximum number of tracks retained in history. More...
 
volatile bool quit_requested = false
 Flag for signal handlers to request shutdown. More...
 
bool quit_initiated = false
 Flag set once a shutdown request has been initiated. More...
 
time_t track_acquisition_time = 0
 The next time at which random track aquisition may be attempted. More...
 
PianodServiceservice = nullptr
 
Retainer< PianodSong * > current_song = nullptr
 
Retainer< PianodSong * > cueing_song = nullptr
 
SongList requests
 
SongList random_queue
 
SongList song_history
 
bool lockout_announced = false
 
Retainer< PianodPlaylist * > current_playlist = nullptr
 
Media::Playerplayer = nullptr
 
Media::Playercueing_player = nullptr
 
TransitionProgress transition_state = TransitionProgress::Playing
 
Announced track_announced = Announced::NEVER
 
PlaybackState playback_state = PlaybackState::PAUSED
 
QueueMode queue_mode = QueueMode::STOPPED
 
time_t pause_expiration = 0
 
signed long abort_playpoint = 0
 Playpoint where crossfaded skip will abort, or 0 for not aborted. More...
 
bool empty_warning_given = false
 
AudioSettings audio
 
Tuner::Tuner mix
 

Static Private Attributes

static const int pause_timeout = 1800
 Pause timeout applied to all sources/songs. More...
 
static const int aquire_tracks_retry = 600
 Retry period if unable to get random tracks. More...
 

Additional Inherited Members

- Public Types inherited from PianodInterpreter
using HelpList = PianodDispatcher::HelpList
 
- Protected Types inherited from PianodInterpreter
using StringVector = std::vector< std::string >
 
- Static Protected Attributes inherited from PianodInterpreter
static const Parsnip::Data EmptyDictionary {Parsnip::Data::Dictionary}
 An empty dictionary, often used as a default with Parsnip::Data::getOr. More...
 
static const StringVector EmptyStringVector
 An empty string vector, often used as a default with Parsnip::Data::getOr. More...
 

Detailed Description

Audio engine, responsible for one "room" worth of audio.

Each audio engine has its own queue, selected playlist(s), and playback status.

Member Typedef Documentation

◆ REQUIREMENT

Prerequisites that may be necessary to execute a particular command.

Member Enumeration Documentation

◆ Announced

enum AudioEngine::Announced
strongprivate

Whether and how completely track information was announced at start of playback.

Enumerator
NEVER 
PARTIALLY 
COMPLETELY 

◆ PlaybackState

enum AudioEngine::PlaybackState
strongprivate
Enumerator
PAUSED 
PLAYING 

◆ QueueMode

enum AudioEngine::QueueMode
strongprivate

Behaviors possible when the player is idle.

Enumerator
STOPPED 

Don't start playing anything.

REQUESTS 

Play only requested songs.

RANDOMPLAY 

Random selections from the current source if no requests.

◆ requirement_t

Prerequisites that may be necessary to execute a particular command.

Enumerator
REQUIRE_SOURCE 

Marks other flags as source-related.

REQUIRE_PLAYLIST 

Marks other flags as playlist-related.

REQUIRE_PLAYER 

Require an audio player exist.

REQUIRE_EXPAND 

Require expand to song list capability.

◆ TransitionProgress

enum AudioEngine::TransitionProgress
strongprivate

States player progresses through when segueing between tracks.

Enumerator
Playing 

the audio player is not transitioning

Purged 

the queue has een purged in preparation for end-of-song

Cueing 

a second audio player has been initialized and is initializing/prefetching.

Crossfading 

the audio players are both playing as audio is cross-faded

Done 

transition is done, but old song keeps right on going.

Constructor & Destructor Documentation

◆ AudioEngine()

AudioEngine::AudioEngine ( PianodService svc,
const AudioSettings audio_options 
)

Create a new audio player attached to a service with an assigned audio output device.

Parameters
svcThe Football service.
audio_optionsThe audio device settings.
Here is the call graph for this function:

◆ ~AudioEngine()

AudioEngine::~AudioEngine ( void  )
virtual

Member Function Documentation

◆ acquireRandomTracks()

bool AudioEngine::acquireRandomTracks ( void  )
private

Retrieves some random tracks and puts them in the queue.

Returns
True on success, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ assembleStatus()

ResponseGroup AudioEngine::assembleStatus ( )

Should be called intermittently by the main run-loop.

Send audio engine status to a client.

Used on login.

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

◆ audioSettings()

const AudioSettings& AudioEngine::audioSettings ( )
inline

◆ authorizedCommand()

bool AudioEngine::authorizedCommand ( Parsnip::Parser::CommandId  command_id,
PianodConnection context 
)
overrideprivatevirtual

Check whether a command is authorized.

Parameters
command_idThe command requesting execution.
contextConnection details, including authentication state and privileges.
Returns
True if allowed, false otherwise.

Implements PianodInterpreter.

Here is the call graph for this function:

◆ cleanupPlayer()

ResponseGroup AudioEngine::cleanupPlayer ( void  )
private

Clean up when a player completes.

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

◆ considerCreatingPlayer()

bool AudioEngine::considerCreatingPlayer ( void  )
private

Create a player, if the current state allows it.

If there is nothing queued, and in random mode, get some random tracks.

Returns
True on success (no player needed or player created), false on player creation error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ constructSeedlist()

DataResponse AudioEngine::constructSeedlist ( const ThingieList things,
PianodPlaylist playlist 
)
staticprivate

Prepare a list of seeds for transmission.

Parameters
thingsThe seeds.
playlistThe playlist to which the seeds belong.
Returns
A data response including the seeds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ controlPlayback()

CommandReply AudioEngine::controlPlayback ( const Parsnip::Data options,
bool  start_playback,
PianodConnection conn 
)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gatherPlaybackStatus() [1/2]

ResponseGroup AudioEngine::gatherPlaybackStatus ( ) const
private
Here is the caller graph for this function:

◆ gatherPlaybackStatus() [2/2]

bool AudioEngine::gatherPlaybackStatus ( ResponseGroup response,
bool  only_if_accurate = false 
) const
private
Here is the call graph for this function:

◆ gatherQueueMode()

Response AudioEngine::gatherQueueMode ( ) const
private
Here is the caller graph for this function:

◆ gatherSelectedPlaylist()

Response AudioEngine::gatherSelectedPlaylist ( ) const
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAutotuneUsers()

UserList AudioEngine::getAutotuneUsers ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getParserDefinitions()

const Parsnip::Parser::Definitions & AudioEngine::getParserDefinitions ( )
overridevirtual

Retrieve the parser definitions handled by the interpreter.

Returns
Parser definitions.

Implements PianodInterpreter.

Here is the call graph for this function:

◆ getPlaylistOrCurrent()

PianodPlaylist * AudioEngine::getPlaylistOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
Ownership::Action  usage 
) const
private

Get a playlist predicate, or use current playlist.

Parameters
connThe connection requesting the things.
optionsPredicate details from the command line.
usageThe manner in which the object is to be accessed.
Returns
The things; may be the empty set.
Exceptions
CommandErroron invalid request, not found, or insufficient privileges for a single-item predicate.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlaylistsOrCurrent() [1/2]

PlaylistList AudioEngine::getPlaylistsOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
CommandReply diagnostics,
Ownership::Action  usage,
const ThingieList default_playlist 
) const
private

Get a playlist predicate, or use one implied by a thing.

Parameters
connThe connection requesting the things.
optionsPredicate details from the command line.
diagnosticsStatus aggregator for problems encountered.
usageThe manner in which the object is to be accessed.
default_playlistA list of songs, from which playlist will be taken (all must have the same playlist).
Returns
The things; may be the empty set.
Exceptions
CommandErroron invalid request, not found, or insufficient privileges for a single-item predicate.
Here is the call graph for this function:

◆ getPlaylistsOrCurrent() [2/2]

PlaylistList AudioEngine::getPlaylistsOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
CommandReply diagnostics,
Ownership::Action  usage = Ownership::Action::USE 
) const
private

Get a playlist predicate, or use current playlist.

Parameters
connThe connection requesting the things.
optionsPredicate details from the command line.
diagnosticsStatus aggregator for problems encountered.
usageThe manner in which the object is to be accessed.
Returns
The things; may be the empty set.
Exceptions
CommandErroron invalid request, not found, or insufficient privileges for a single-item predicate.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSongsOrCurrent()

SongList AudioEngine::getSongsOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
CommandReply diagnostics,
Ownership::Action  usage = Ownership::Action::USE 
) const
private

Get a songlist predicate, or use current song.

Parameters
connThe connection requesting the songs.
optionsPredicate details from the command line.
diagnosticsStatus aggregator for problems encountered.
usageThe manner in which the object is to be accessed.
Returns
The songs; may be the empty set.
Exceptions
CommandErroron invalid request, not found, or insufficient privileges for a single-item predicate.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getThingOrCurrent() [1/2]

MusicThingie * AudioEngine::getThingOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
MusicThingie::Type  want,
Ownership::Action  usage = Ownership::Action::USE 
) const
private

Get a thing from a predicate, ensure usability and it conforms to a type.

Parameters
connThe connection requesting the items.
optionsPredicate details from the command line.
wantIndicates the type of thing wanted.
usageThe manner in which the object is to be accessed.
Returns
The thing
Exceptions
CommandErroron invalid request, not found, or insufficient privileges.
Here is the call graph for this function:

◆ getThingOrCurrent() [2/2]

MusicThingie * AudioEngine::getThingOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
Ownership::Action  usage = Ownership::Action::USE 
) const
private

Get a thing from a predicate and ensure it is usable.

Parameters
connThe connection requesting the items.
optionsPredicate details from the command line.
usageThe manner in which the object is to be accessed.
Returns
The thing
Exceptions
CommandErroron invalid request, not found, or insufficient privileges.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getThingsOrCurrent() [1/2]

ThingieList AudioEngine::getThingsOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
CommandReply diagnostics,
Ownership::Action  usage = Ownership::Action::USE 
) const
private

Get some things from a predicate and ensure they is usable.

Parameters
connThe connection requesting the things.
optionsPredicate details from the command line.
diagnosticsStatus aggregator for problems encountered.
usageThe manner in which the object is to be accessed.
Returns
The things; may be the empty set.
Exceptions
CommandErroron invalid request, not found, or insufficient privileges for a single-item predicate.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getThingsOrCurrent() [2/2]

ThingieList AudioEngine::getThingsOrCurrent ( const PianodConnection conn,
const Parsnip::Data options,
MusicThingie::Type  want,
CommandReply diagnostics,
Ownership::Action  usage = Ownership::Action::USE 
) const
private

Get things from a predicate, ensure usability and it conforms to a type.

Parameters
connThe connection requesting the things.
optionsPredicate details from the command line.
wantIndicates the type of thing wanted.
diagnosticsStatus aggregator for problems encountered.
usageThe manner in which the object is to be accessed.
Returns
The things; may be the empty set.
Exceptions
CommandErroron invalid request, not found, or insufficient privileges for a single-item predicate.
Here is the call graph for this function:

◆ handleCommand()

ResponseCollector AudioEngine::handleCommand ( Parsnip::Parser::CommandId  command_id,
const Parsnip::Data parameters,
PianodConnection context 
)
overrideprivatevirtual

Command handler.

Parameters
command_idCommand to execute.
parametersCommand parameters.
contextConnection details, including authentication state and privileges.
Returns
Data or success/failure indications.
Exceptions
CommandErroror other exception if an error occurs.

Implements PianodInterpreter.

◆ json_request_names()

const PianodSchema::CommandIds & AudioEngine::json_request_names ( )
static

Retrieve names for our JSON requests.

Returns
Request name to command ID mappings.
Here is the caller graph for this function:

◆ mixChanged()

void AudioEngine::mixChanged ( bool  automatic,
const char *  why 
)
private

When mix has changed, reset track aquisition lockouts.

Here is the caller graph for this function:

◆ monitorPlayer()

float AudioEngine::monitorPlayer ( void  )
private

Check/respond to various things with the player.

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

◆ parser_definitions()

const Parsnip::Parser::Definitions & AudioEngine::parser_definitions ( void  )
static

Play/select music, queue mode, playback

Play/select music, queue mode, playback

Here is the caller graph for this function:

◆ periodic()

float AudioEngine::periodic ( void  )

Periodically invoked function that monitors players, starts new songs, etc.

Here is the call graph for this function:

◆ playback_selection_option_definitions()

const Parsnip::OptionParser::Definitions & AudioEngine::playback_selection_option_definitions ( )
static

Parse definitions for playback control

Here is the caller graph for this function:

◆ playbackState()

ResponseGroup AudioEngine::playbackState ( PlaybackState  state,
PianodConnection conn = nullptr 
)
private

Pause or resume playback.

Parameters
stateIndicates whether to play or pause.
connConnection requesting change, or nullptr.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ playlistsChanged()

void AudioEngine::playlistsChanged ( )
private

When playlists have changed, reset track aquisition lockouts.

Here is the caller graph for this function:

◆ promotePlayer()

ResponseGroup AudioEngine::promotePlayer ( void  )
private

Promote the cueing player to the primary player. *‍/.

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

◆ PurgeUnselectedSongs()

void AudioEngine::PurgeUnselectedSongs ( void  )
private

Remove songs from the front of the random queue (but not songs from the request queue).

Reasons songs may be removed:

  • The mix or selected playlist has changed, and it no longer applies.
  • The song has expired.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ queueEmpty()

bool AudioEngine::queueEmpty ( void  ) const
inlineprivate
Here is the caller graph for this function:

◆ queueMode()

ResponseGroup AudioEngine::queueMode ( QueueMode  mode,
PianodConnection conn = nullptr 
)
private

Set the queueing mode.

Parameters
modeIndicates stopped, requests only, or random play.
connConnection requesting change, or nullptr.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerInterpreter()

void AudioEngine::registerInterpreter ( PianodDispatcher dispatcher)
overridevirtual

Register the interpreter with a dispatcher.

Parameters
dispatcherThe dispatcher with which to register.

Reimplemented from PianodInterpreter.

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

◆ require()

void AudioEngine::require ( PianodConnection conn,
unsigned long  requirements 
) const
private

Check that required state/privileges are available.

Exceptions
CommandErrorif requirements are not met.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendSongLists()

SongList AudioEngine::sendSongLists ( PianodConnection conn,
const Parsnip::Data options,
bool  historical 
)
private

Generate response messages.

Send the queue or history.

Allow negative indexes from either to refer to the other; 0 refers to current track. This makes implementing paging on clients easier because it won't have to use separate commands.

Parameters
connThe connection to which the list is being sent.
optionsPredicate details from the command line.
historicalIf true, looks toward history; if false, toward future.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown()

void AudioEngine::shutdown ( bool  immediate)

Initiate shutdown of the audio engine.

Parameters
immediateIf true, aborts playback. If false, allows playback to complete before shutdown.
Here is the call graph for this function:

◆ sourceOffline()

void AudioEngine::sourceOffline ( const Media::Source * const  source)
private

Unregister a source by removing its playlists.

However, allow items to remain in the history and queue (in case it comes back online).

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

◆ sourceReady()

void AudioEngine::sourceReady ( const Media::Source * const  )
private

When a new source is ready, clear any track aquisition delays.

Here is the caller graph for this function:

◆ sourceRemovalCheck()

bool AudioEngine::sourceRemovalCheck ( const Media::Source *const  source)
private

Remove all songs from a given source.

Parameters
sourceThe source to remove.
Returns
True if successfully eradicated, false if not (busy playing media from the source).
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sourceRemoved()

void AudioEngine::sourceRemoved ( const Media::Source *const  source)
private

Unregister a source by removing its playlists.

However, allow items to remain in the history and queue (in case it comes back online).

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

◆ sourceStatus()

void AudioEngine::sourceStatus ( RESPONSE_CODE  status,
const char *  detail 
)
private

Transmit any source status notifications to connected clients.

Parameters
statusThe numeric status code.
detailAdditional details about the status.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ startPlayer()

bool AudioEngine::startPlayer ( void  )
private

Start playback of a the next song in the queue.

Preconditons: playlist should have a list in it.

Returns
True on player started, false on error.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateStatus()

ResponseGroup AudioEngine::updateStatus ( PianodConnection there)

Update audio engine status to a client.

Used on authentication.

Here is the caller graph for this function:

◆ usersChangedNotification()

void AudioEngine::usersChangedNotification ( void  )
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ abort_playpoint

signed long AudioEngine::abort_playpoint = 0
private

Playpoint where crossfaded skip will abort, or 0 for not aborted.

◆ aquire_tracks_retry

const int AudioEngine::aquire_tracks_retry = 600
staticprivate

Retry period if unable to get random tracks.

◆ audio

AudioSettings AudioEngine::audio
private

◆ cueing_player

Media::Player* AudioEngine::cueing_player = nullptr
private

◆ cueing_song

Retainer<PianodSong *> AudioEngine::cueing_song = nullptr
private

◆ current_playlist

Retainer<PianodPlaylist *> AudioEngine::current_playlist = nullptr
private

◆ current_song

Retainer<PianodSong *> AudioEngine::current_song = nullptr
private

◆ empty_warning_given

bool AudioEngine::empty_warning_given = false
private

◆ history_size

SongList::size_type AudioEngine::history_size = 10
private

Maximum number of tracks retained in history.

◆ lockout_announced

bool AudioEngine::lockout_announced = false
private

◆ mix

Tuner::Tuner AudioEngine::mix
private

◆ onset

time_t AudioEngine::onset = 0

Clock time at which a playback stall was detected.

◆ onset_playpoint

time_t AudioEngine::onset_playpoint = 0

Playback point at which a playback stall was detected.

◆ pause_expiration

time_t AudioEngine::pause_expiration = 0
private

◆ pause_timeout

const int AudioEngine::pause_timeout = 1800
staticprivate

Pause timeout applied to all sources/songs.

◆ playback_effective_start

time_t AudioEngine::playback_effective_start = 0

When not stalled, current time minus playback point.

◆ playback_state

PlaybackState AudioEngine::playback_state = PlaybackState::PAUSED
private

◆ player

Media::Player* AudioEngine::player = nullptr
private

◆ prefetch_time

const float AudioEngine::prefetch_time = 5
private

Number of seconds before cuing at which queue is refreshed.

◆ queue_mode

QueueMode AudioEngine::queue_mode = QueueMode::STOPPED
private

◆ quit_initiated

bool AudioEngine::quit_initiated = false
private

Flag set once a shutdown request has been initiated.

◆ quit_requested

volatile bool AudioEngine::quit_requested = false
private

Flag for signal handlers to request shutdown.

◆ random_queue

SongList AudioEngine::random_queue
private

◆ requests

SongList AudioEngine::requests
private

◆ service

PianodService* AudioEngine::service = nullptr
private

◆ song_history

SongList AudioEngine::song_history
private

◆ 

struct { ... } AudioEngine::stall

Structure used to track player progress/status.

◆ track_acquisition_time

time_t AudioEngine::track_acquisition_time = 0
private

The next time at which random track aquisition may be attempted.

◆ track_announced

Announced AudioEngine::track_announced = Announced::NEVER
private

◆ transition_state

TransitionProgress AudioEngine::transition_state = TransitionProgress::Playing
private

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