mirror of
https://github.com/esphome/esphome.git
synced 2024-11-27 17:27:59 +01:00
some extra fixes
This commit is contained in:
parent
a671507be6
commit
4e03bb977e
3 changed files with 4 additions and 4 deletions
|
@ -10,7 +10,7 @@ AudioStreamer *AudioListener::start(const AudioStreamInfo &audio_stream_info) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
if (this->starting(audio_stream_info)) {
|
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);
|
this->current_streamer_->set_parent(this);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -20,13 +20,13 @@ template<typename... Ts> class PlayAction : public Action<Ts...>, public Parente
|
||||||
}
|
}
|
||||||
|
|
||||||
void play(Ts... x) override {
|
void play(Ts... x) override {
|
||||||
auto val = this->data_func_(x...);
|
auto val = data_static_;
|
||||||
|
|
||||||
if (!this->static_) {
|
if (!this->static_) {
|
||||||
val = this->data_func_(x...);
|
val = this->data_func_(x...);
|
||||||
}
|
}
|
||||||
auto streamer = this->parent_->start();
|
auto streamer = this->parent_->start();
|
||||||
streamer->stream(val);
|
streamer->stream(val.data(), val.size());
|
||||||
delete streamer;
|
delete streamer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -436,7 +436,7 @@ void VoiceAssistant::write_speaker_() {
|
||||||
if ((this->speaker_ != nullptr) && (this->speaker_buffer_ != nullptr)) {
|
if ((this->speaker_ != nullptr) && (this->speaker_buffer_ != nullptr)) {
|
||||||
if (this->speaker_buffer_size_ > 0) {
|
if (this->speaker_buffer_size_ > 0) {
|
||||||
size_t write_chunk = std::min<size_t>(this->speaker_buffer_size_, 4 * 1024);
|
size_t write_chunk = std::min<size_t>(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) {
|
if (written > 0) {
|
||||||
memmove(this->speaker_buffer_, this->speaker_buffer_ + written, this->speaker_buffer_size_ - written);
|
memmove(this->speaker_buffer_, this->speaker_buffer_ + written, this->speaker_buffer_size_ - written);
|
||||||
this->speaker_buffer_size_ -= written;
|
this->speaker_buffer_size_ -= written;
|
||||||
|
|
Loading…
Reference in a new issue