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 --- luals-stubs/queue.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'luals-stubs') diff --git a/luals-stubs/queue.lua b/luals-stubs/queue.lua index 0fcb6258..0abf3339 100644 --- a/luals-stubs/queue.lua +++ b/luals-stubs/queue.lua @@ -9,6 +9,8 @@ --- @field position Property The index in the queue of the currently playing track. This may be zero if the queue is empty. Writeable. --- @field size Property The total number of tracks in the queue, including tracks which have already been played. --- @field repeat_mode Property The current repeat mode for the queue. Writeable. +--- @field loading Property Whether or not the queue is currently loading tracks. +--- @field ready Property Whether or not the queue is ready to be used. --- @field random Property Determines whether, when progressing to the next track in the queue, the next track will be chosen randomly. The random selection algorithm used is a Miller Shuffle, which guarantees that no repeat selections will be made until every item in the queue has been played. Writeable. local queue = {} -- cgit v1.2.3