26 static const size_t SAMPLE_BUFFER_SIZE = 2048;
49 void play(std::string rtttl);
51 void dump_config()
override;
57 this->on_finished_playback_callback_.add(std::move(callback));
63 while (isdigit(this->rtttl_[this->position_])) {
64 ret = (ret * 10) + (this->rtttl_[this->position_++] -
'0');
71 std::string rtttl_{
""};
89 int sample_rate_{16000};
90 int samples_per_wave_{0};
92 int samples_count_{0};
105 void play(Ts...
x)
override { this->rtttl_->play(this->value_.value(
x...)); }
113 void play(Ts...
x)
override { this->parent_->stop(); }
118 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.