Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
Functions
Music Player

Description

Interacting with the music player.

Collaboration diagram for Music Player:

Functions

void AppMusicPlayerOn ()
 Switch on the music player. If necessary, a connection the the last MPD servcer is openend, and that player is set into the "play" state.
 
void AppMusicPlayerOff ()
 Stop the music player.
 
bool AppMusicSetServer (const char *id)
 Select MPD server by its ID.
 
bool AppMusicIsPlaying ()
 Return 'true' if the player is actually playing.
 
bool AppMusicIsPlayingOrShouldBe ()
 Return 'true' if the player is either actually playing or should be playing, but is not for a reason not intended by the user. Use this variant to decide if background mode can be quit.
 
bool AppMusicIsPlayingForSure (int minDb=-INT_MAX)
 Return 'true' if the player is actually playing and it is guaranteed that either the user can hear something or the player is muted. More...
 

Function Documentation

◆ AppMusicIsPlayingForSure()

bool AppMusicIsPlayingForSure ( int  minDb = -INT_MAX)

Return 'true' if the player is actually playing and it is guaranteed that either the user can hear something or the player is muted.

At least this is the goal - there may be some more holes to fix, for example, if the music itself contains silence. The latter, however, is addressed by the 'minDb' argument if the output is streamed to the local device.

Use this variant for an alarm clock to check if the user gets woken up or if some other measure has to be taken. 'minDb' is the minimum required DB level (< 0; 0 = max.) that is considered to be sufficiently hearable.