The SetTrack event is sent when *decoding* finishes, not when
*playback* finishes so the decoder can start buffering the next
track in advance of its playback to ensure gapless playback.
Clearing StreamCues causes
Playback::react(const internal::StreamHeartbeat& ev)
to transit the Playback FSM to Standby, which sets the
IAudioOutput to stop reading from the output buffer. Thus,
clearing StreamCues in response to the SetTrack event paused
playback with the end of the track stuck waiting in the output
buffer. When a new queue was loaded and started playing, the
end of the previous track would be played before the new track
was played.
Fixes https://codeberg.org/cool-tech-zone/tangara-fw/issues/313
Queue now has a separate 'ready' property to indicate it's ready to be used, which is independent from whether it's still loading tracks in. This also improves the response time for shuffling all tracks (we will initially pick a random track in the first 100 tracks whilst the rest of the tracks are loading). This should also fix issues where one song will start playing and then repeat itself when the queue finishes loading, and hopefully solve #160 as well (though I couldn't actually repro this myself).
Co-authored-by: jacqueline <me@jacqueline.id.au>
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/170
Reviewed-by: cooljqln <cooljqln@noreply.codeberg.org>
Co-authored-by: ailurux <ailuruxx@gmail.com>
Co-committed-by: ailurux <ailuruxx@gmail.com>