26 static const size_t SAMPLE_BUFFER_SIZE = 2048;
50 void play(std::string rtttl);
52 void dump_config()
override;
58 this->on_finished_playback_callback_.add(std::move(callback));
64 while (isdigit(this->rtttl_[this->position_])) {
65 ret = (ret * 10) + (this->rtttl_[this->position_++] -
'0');
72 std::string rtttl_{
""};
90 int sample_rate_{16000};
91 int samples_per_wave_{0};
93 int samples_count_{0};
106 void play(Ts...
x)
override { this->rtttl_->play(this->value_.value(
x...)); }
114 void play(Ts...
x)
override { this->parent_->stop(); }
119 bool check(Ts...
x)
override {
return this->parent_->is_playing(); }
void set_gain(float gain)
void play(Ts... x) override
Base class for all output components that can output a variable level, like PWM.
CallbackManager< void()> on_finished_playback_callback_
bool check(Ts... x) override
Base class for all automation conditions.
uint16_t default_duration_
void set_speaker(speaker::Speaker *speaker)
void set_output(output::FloatOutput *output)
output::FloatOutput * output_
TEMPLATABLE_VALUE(std::string, value) void play(Ts... x) override
void add_on_finished_playback_callback(std::function< void()> callback)
Implementation of SPI Controller mode.
FinishedPlaybackTrigger(Rtttl *parent)
Helper class to easily give an object a parent of type T.