Add has_buffered_data() function to ESPADFSpeaker class

This commit is contained in:
Jesse Hills 2023-11-24 21:19:29 +13:00
parent f500bd5e6f
commit 970680b1b2
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 4 additions and 0 deletions

View file

@ -266,6 +266,8 @@ size_t ESPADFSpeaker::play(const uint8_t *data, size_t length) {
return index; return index;
} }
bool ESPADFSpeaker::has_buffered_data() const { return uxQueueMessagesWaiting(this->buffer_queue_) > 0; }
} // namespace esp_adf } // namespace esp_adf
} // namespace esphome } // namespace esphome

View file

@ -29,6 +29,8 @@ class ESPADFSpeaker : public ESPADFPipeline, public speaker::Speaker, public Com
size_t play(const uint8_t *data, size_t length) override; size_t play(const uint8_t *data, size_t length) override;
bool has_buffered_data() const override;
protected: protected:
void start_(); void start_();
void watch_(); void watch_();