Merge pull request 'fix premature pause at end of last track of queue' (#317) from Be.ing/tangara-fw:premature_pause into main

Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/317
custom-try-329
ailurux 6 days ago
commit 20ccf51d2b
  1. 3
      src/tangara/audio/audio_fsm.cpp
  2. 5
      src/tangara/audio/stream_cues.cpp
  3. 2
      src/tangara/audio/stream_cues.hpp

@ -148,9 +148,7 @@ void AudioState::react(const QueueUpdate& ev) {
void AudioState::react(const SetTrack& ev) {
if (std::holds_alternative<std::monostate>(ev.new_track)) {
ESP_LOGI(kTag, "playback finished, awaiting drain");
sDecoder->open({});
sStreamCues.clear();
return;
}
@ -212,6 +210,7 @@ void AudioState::react(const TtsPlaybackChanged& ev) {
}
void AudioState::react(const internal::DecodingFinished& ev) {
ESP_LOGD(kTag, "end of file decoded; awaiting playback of buffered audio");
// If we just finished playing whatever's at the front of the queue, then we
// need to advanve and start playing the next one ASAP in order to continue
// gaplessly.

@ -43,11 +43,6 @@ auto StreamCues::addCue(std::shared_ptr<TrackInfo> track, uint32_t sample)
}
}
auto StreamCues::clear() -> void {
upcoming_.clear();
current_ = {};
}
auto StreamCues::current() -> std::pair<std::shared_ptr<TrackInfo>, uint32_t> {
if (!current_) {
return {};

@ -34,8 +34,6 @@ class StreamCues {
auto addCue(std::shared_ptr<TrackInfo>, uint32_t start_at) -> void;
auto clear() -> void;
private:
uint32_t now_;

Loading…
Cancel
Save