Tracks a separate volume for announcements that start while nothing else is playing.
More...
#include <announcement_volume.h>
|
| template<typename F > |
| void | set_volume (float volume, F &&apply) |
| | Stores a new announcement volume and applies it right away if it is in use.
|
| |
| float | get_volume () const |
| |
| bool | is_configured () const |
| |
| bool | is_active () const |
| |
| template<typename F > |
| void | begin (bool other_audio_playing, F &&apply) |
| | Called when an announcement starts.
|
| |
| template<typename F > |
| void | end (float media_volume, F &&apply) |
| | Switches back to the media player volume if the announcement volume is in use.
|
| |
| void | cancel () |
| | The media player volume was set and already sent to the speakers; it applies until the next announcement.
|
| |
| template<typename F > |
| void | item_started (bool is_announcement, bool other_audio_playing, float media_volume, F &&apply) |
| | Called when an item starts on a playlist that holds announcements, and may hold media too.
|
| |
| template<typename F > |
| void | playlist_finished (float media_volume, F &&apply) |
| | Called when the playlist that holds announcements has finished. Switches back to the media volume.
|
| |
Tracks a separate volume for announcements that start while nothing else is playing.
The methods that change the volume take apply, called with the volume the speakers must switch to.
Definition at line 10 of file announcement_volume.h.
◆ begin()
template<typename F >
| void esphome::speaker::AnnouncementVolume::begin |
( |
bool | other_audio_playing, |
|
|
F && | apply ) |
|
inline |
Called when an announcement starts.
Switches to the announcement volume unless other audio is playing.
- Parameters
-
| other_audio_playing | Media, or an announcement that does not use the announcement volume, is playing |
Definition at line 25 of file announcement_volume.h.
◆ cancel()
| void esphome::speaker::AnnouncementVolume::cancel |
( |
| ) |
|
|
inline |
The media player volume was set and already sent to the speakers; it applies until the next announcement.
Definition at line 45 of file announcement_volume.h.
◆ end()
template<typename F >
| void esphome::speaker::AnnouncementVolume::end |
( |
float | media_volume, |
|
|
F && | apply ) |
|
inline |
Switches back to the media player volume if the announcement volume is in use.
Definition at line 35 of file announcement_volume.h.
◆ get_volume()
| float esphome::speaker::AnnouncementVolume::get_volume |
( |
| ) |
const |
|
inline |
◆ is_active()
| bool esphome::speaker::AnnouncementVolume::is_active |
( |
| ) |
const |
|
inline |
◆ is_configured()
| bool esphome::speaker::AnnouncementVolume::is_configured |
( |
| ) |
const |
|
inline |
◆ item_started()
template<typename F >
| void esphome::speaker::AnnouncementVolume::item_started |
( |
bool | is_announcement, |
|
|
bool | other_audio_playing, |
|
|
float | media_volume, |
|
|
F && | apply ) |
|
inline |
Called when an item starts on a playlist that holds announcements, and may hold media too.
Media switches back to the media volume. An announcement that follows media, or starts the playlist, switches to the announcement volume unless other audio is playing. One that follows another announcement keeps the volume that one used, including a volume change made while it played.
Definition at line 52 of file announcement_volume.h.
◆ log_begin_()
| void esphome::speaker::AnnouncementVolume::log_begin_ |
( |
| ) |
const |
|
protected |
◆ log_end_()
| void esphome::speaker::AnnouncementVolume::log_end_ |
( |
float | media_volume | ) |
const |
|
protected |
◆ playlist_finished()
template<typename F >
| void esphome::speaker::AnnouncementVolume::playlist_finished |
( |
float | media_volume, |
|
|
F && | apply ) |
|
inline |
Called when the playlist that holds announcements has finished. Switches back to the media volume.
Definition at line 62 of file announcement_volume.h.
◆ set_volume()
template<typename F >
| void esphome::speaker::AnnouncementVolume::set_volume |
( |
float | volume, |
|
|
F && | apply ) |
|
inline |
Stores a new announcement volume and applies it right away if it is in use.
Definition at line 13 of file announcement_volume.h.
◆ active_
| bool esphome::speaker::AnnouncementVolume::active_ {false} |
|
protected |
◆ last_item_announcement_
| bool esphome::speaker::AnnouncementVolume::last_item_announcement_ {false} |
|
protected |
◆ volume_
| float esphome::speaker::AnnouncementVolume::volume_ {NAN} |
|
protected |
The documentation for this class was generated from the following files: