mirror of
https://github.com/esphome/esphome.git
synced 2024-11-06 09:25:37 +01:00
Expose start to speaker interface (#5228)
This commit is contained in:
parent
2fa79a2e2f
commit
351e7ea16b
@ -51,7 +51,7 @@ class I2SAudioSpeaker : public Component, public speaker::Speaker, public I2SAud
|
||||
#endif
|
||||
void set_external_dac_channels(uint8_t channels) { this->external_dac_channels_ = channels; }
|
||||
|
||||
void start();
|
||||
void start() override;
|
||||
void stop() override;
|
||||
|
||||
size_t play(const uint8_t *data, size_t length) override;
|
||||
|
@ -13,8 +13,9 @@ enum State : uint8_t {
|
||||
class Speaker {
|
||||
public:
|
||||
virtual size_t play(const uint8_t *data, size_t length) = 0;
|
||||
virtual size_t play(const std::vector<uint8_t> &data) { return this->play(data.data(), data.size()); }
|
||||
size_t play(const std::vector<uint8_t> &data) { return this->play(data.data(), data.size()); }
|
||||
|
||||
virtual void start() = 0;
|
||||
virtual void stop() = 0;
|
||||
|
||||
bool is_running() const { return this->state_ == STATE_RUNNING; }
|
||||
|
Loading…
Reference in New Issue
Block a user