From 4e03bb977e5c775b239b317ca9bc9fc4302f13b0 Mon Sep 17 00:00:00 2001 From: NP v/d Spek Date: Mon, 28 Oct 2024 22:03:33 +0100 Subject: [PATCH] some extra fixes --- esphome/components/audio/audio.cpp | 2 +- esphome/components/speaker/automation.h | 4 ++-- esphome/components/voice_assistant/voice_assistant.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/audio/audio.cpp b/esphome/components/audio/audio.cpp index 7602f2128c..213331eba3 100644 --- a/esphome/components/audio/audio.cpp +++ b/esphome/components/audio/audio.cpp @@ -10,7 +10,7 @@ AudioStreamer *AudioListener::start(const AudioStreamInfo &audio_stream_info) { return nullptr; } if (this->starting(audio_stream_info)) { - this->current_streamer_ = new AudioStreamer(); + this->current_streamer_ = new AudioStreamer(); // NOLINT(cppcoreguidelines-owning-memory) this->current_streamer_->set_parent(this); } return nullptr; diff --git a/esphome/components/speaker/automation.h b/esphome/components/speaker/automation.h index c62b61b892..ed1f87f3b6 100644 --- a/esphome/components/speaker/automation.h +++ b/esphome/components/speaker/automation.h @@ -20,13 +20,13 @@ template class PlayAction : public Action, public Parente } void play(Ts... x) override { - auto val = this->data_func_(x...); + auto val = data_static_; if (!this->static_) { val = this->data_func_(x...); } auto streamer = this->parent_->start(); - streamer->stream(val); + streamer->stream(val.data(), val.size()); delete streamer; } diff --git a/esphome/components/voice_assistant/voice_assistant.cpp b/esphome/components/voice_assistant/voice_assistant.cpp index 6f164f69d3..cd3ba1f835 100644 --- a/esphome/components/voice_assistant/voice_assistant.cpp +++ b/esphome/components/voice_assistant/voice_assistant.cpp @@ -436,7 +436,7 @@ void VoiceAssistant::write_speaker_() { if ((this->speaker_ != nullptr) && (this->speaker_buffer_ != nullptr)) { if (this->speaker_buffer_size_ > 0) { size_t write_chunk = std::min(this->speaker_buffer_size_, 4 * 1024); - size_t written = this->speaker_->play(this->speaker_buffer_, write_chunk); + size_t written = 0; // this->speaker_->play(this->speaker_buffer_, write_chunk); if (written > 0) { memmove(this->speaker_buffer_, this->speaker_buffer_ + written, this->speaker_buffer_size_ - written); this->speaker_buffer_size_ -= written;