From 829d033a448107f1bc610cf735ce9f7222de564b Mon Sep 17 00:00:00 2001 From: ailurux Date: Tue, 7 Jan 2025 00:00:00 +0000 Subject: Improvements to the queue for shuffling/playing all (#170) 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 Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/170 Reviewed-by: cooljqln Co-authored-by: ailurux Co-committed-by: ailurux --- src/tangara/audio/stream_cues.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/tangara/audio/stream_cues.cpp') diff --git a/src/tangara/audio/stream_cues.cpp b/src/tangara/audio/stream_cues.cpp index 6a9a7674..611138c6 100644 --- a/src/tangara/audio/stream_cues.cpp +++ b/src/tangara/audio/stream_cues.cpp @@ -43,6 +43,11 @@ auto StreamCues::addCue(std::shared_ptr track, uint32_t sample) } } +auto StreamCues::clear() -> void { + upcoming_.clear(); + current_ = {}; +} + auto StreamCues::current() -> std::pair, uint32_t> { if (!current_) { return {}; -- cgit v1.2.3