ESPHome  2024.2.0
speaker.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace esphome {
4 namespace speaker {
5 
6 enum State : uint8_t {
11 };
12 
13 class Speaker {
14  public:
15  virtual size_t play(const uint8_t *data, size_t length) = 0;
16  size_t play(const std::vector<uint8_t> &data) { return this->play(data.data(), data.size()); }
17 
18  virtual void start() = 0;
19  virtual void stop() = 0;
20 
21  virtual bool has_buffered_data() const = 0;
22 
23  bool is_running() const { return this->state_ == STATE_RUNNING; }
24 
25  protected:
27 };
28 
29 } // namespace speaker
30 } // namespace esphome
virtual size_t play(const uint8_t *data, size_t length)=0
bool is_running() const
Definition: speaker.h:23
virtual bool has_buffered_data() const =0
size_t play(const std::vector< uint8_t > &data)
Definition: speaker.h:16
virtual void start()=0
uint16_t length
Definition: tt21100.cpp:12
This is a workaround until we can figure out a way to get the tflite-micro idf component code availab...
Definition: a01nyub.cpp:7
virtual void stop()=0