ESPHome
2025.2.0
esphome
esphome
components
speaker
media_player
automation.h
Go to the documentation of this file.
1
#pragma once
2
3
#include "
speaker_media_player.h
"
4
5
#ifdef USE_ESP_IDF
6
7
#include "
esphome/components/audio/audio.h
"
8
#include "
esphome/core/automation.h
"
9
10
namespace
esphome
{
11
namespace
speaker {
12
13
template
<
typename
... Ts>
class
PlayOnDeviceMediaAction
:
public
Action
<Ts...>,
public
Parented
<SpeakerMediaPlayer> {
14
TEMPLATABLE_VALUE(
audio::AudioFile
*, audio_file)
15
TEMPLATABLE_VALUE(
bool
, announcement)
16
TEMPLATABLE_VALUE(
bool
, enqueue)
17
void
play
(Ts...
x
)
override
{
18
this->
parent_
->play_file(this->audio_file_.value(
x
...), this->announcement_.value(
x
...),
19
this->enqueue_.value(
x
...));
20
}
21
};
22
23
}
// namespace speaker
24
}
// namespace esphome
25
26
#endif
audio.h
x
uint16_t x
Definition:
tt21100.cpp:17
automation.h
esphome::Action
Definition:
automation.h:121
esphome::Parented< SpeakerMediaPlayer >::parent_
SpeakerMediaPlayer * parent_
Definition:
helpers.h:549
esphome::audio::AudioFile
Definition:
audio.h:119
esphome
Implementation of SPI Controller mode.
Definition:
a01nyub.cpp:7
speaker_media_player.h
esphome::speaker::PlayOnDeviceMediaAction
Definition:
automation.h:13
esphome::Action< Ts... >::play
virtual void play(Ts... x)=0
esphome::Parented
Helper class to easily give an object a parent of type T.
Definition:
helpers.h:538
Generated by
1.8.13