diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-07-30 14:56:58 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-07-30 14:56:58 +1000 |
| commit | 649cb74f036c392264264d35f98bef1fa4a5a8aa (patch) | |
| tree | bbe5b03394f5fb59d208a2c68d1ca034f0c4d76f /src/tangara/audio/audio_fsm.cpp | |
| parent | 2a280c9b4b3afdedf68f8b27b8ce8dad6ab9470f (diff) | |
| download | tangara-fw-649cb74f036c392264264d35f98bef1fa4a5a8aa.tar.gz | |
Advance the queue when the current track fails to start
Diffstat (limited to 'src/tangara/audio/audio_fsm.cpp')
| -rw-r--r-- | src/tangara/audio/audio_fsm.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/tangara/audio/audio_fsm.cpp b/src/tangara/audio/audio_fsm.cpp index 65261d75..a43cd932 100644 --- a/src/tangara/audio/audio_fsm.cpp +++ b/src/tangara/audio/audio_fsm.cpp @@ -142,7 +142,20 @@ void AudioState::react(const SetTrack& ev) { sStreamFactory->create(std::get<std::string>(new_track), seek_to); } + // Always give the stream to the decoder, even if it turns out to be empty. + // This has the effect of stopping the current playback, which is generally + // what the user expects to happen when they say "Play this track!", even + // if the new track has an issue. sDecoder->open(stream); + + // ...but if the stream that failed is the front of the queue, then we + // should advance to the next track in order to keep the tunes flowing. + if (!stream) { + auto& queue = sServices->track_queue(); + if (new_track == queue.current()) { + queue.finish(); + } + } }); } |
