From 970680b1b2fee9652e7d2689133d1d34945d382f Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Fri, 24 Nov 2023 21:19:29 +1300 Subject: [PATCH] Add has_buffered_data() function to ESPADFSpeaker class --- esphome/components/esp_adf/speaker/esp_adf_speaker.cpp | 2 ++ esphome/components/esp_adf/speaker/esp_adf_speaker.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/esphome/components/esp_adf/speaker/esp_adf_speaker.cpp b/esphome/components/esp_adf/speaker/esp_adf_speaker.cpp index 856507ec2b..ca616a21a6 100644 --- a/esphome/components/esp_adf/speaker/esp_adf_speaker.cpp +++ b/esphome/components/esp_adf/speaker/esp_adf_speaker.cpp @@ -266,6 +266,8 @@ size_t ESPADFSpeaker::play(const uint8_t *data, size_t length) { return index; } +bool ESPADFSpeaker::has_buffered_data() const { return uxQueueMessagesWaiting(this->buffer_queue_) > 0; } + } // namespace esp_adf } // namespace esphome diff --git a/esphome/components/esp_adf/speaker/esp_adf_speaker.h b/esphome/components/esp_adf/speaker/esp_adf_speaker.h index 2b3c151c79..d6729970c1 100644 --- a/esphome/components/esp_adf/speaker/esp_adf_speaker.h +++ b/esphome/components/esp_adf/speaker/esp_adf_speaker.h @@ -29,6 +29,8 @@ class ESPADFSpeaker : public ESPADFPipeline, public speaker::Speaker, public Com size_t play(const uint8_t *data, size_t length) override; + bool has_buffered_data() const override; + protected: void start_(); void watch_();