18 static const size_t SAMPLE_BUFFER_SIZE = 512;
41 void play(std::string rtttl);
43 void dump_config()
override;
49 this->on_finished_playback_callback_.add(std::move(callback));
55 while (isdigit(this->rtttl_[this->position_])) {
56 ret = (ret * 10) + (this->rtttl_[this->position_++] -
'0');
61 std::string rtttl_{
""};
80 int sample_rate_{16000};
81 int samples_per_wave_{0};
83 int samples_count_{0};
96 void play(Ts...
x)
override { this->rtttl_->play(this->value_.value(
x...)); }
104 void play(Ts...
x)
override { this->parent_->stop(); }
109 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)
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
FinishedPlaybackTrigger(Rtttl *parent)
Helper class to easily give an object a parent of type T.