26 static const size_t SAMPLE_BUFFER_SIZE = 2048;
44 void play(std::string rtttl);
46 void dump_config()
override;
52 this->on_finished_playback_callback_.add(std::move(callback));
58 while (isdigit(this->rtttl_[this->position_])) {
59 ret = (ret * 10) + (this->rtttl_[this->position_++] -
'0');
66 std::string rtttl_{
""};
84 int sample_rate_{16000};
85 int samples_per_wave_{0};
87 int samples_count_{0};
100 void play(Ts...
x)
override { this->rtttl_->play(this->value_.value(
x...)); }
108 void play(Ts...
x)
override { this->parent_->stop(); }
113 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_
constexpr const T & clamp(const T &v, const T &lo, const T &hi, Compare comp)
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.