summaryrefslogtreecommitdiff
path: root/src/tangara/ui/ui_fsm.cpp
diff options
context:
space:
mode:
authorailurux <ailuruxx@gmail.com>2025-01-07 00:00:00 +0000
committercooljqln <cooljqln@noreply.codeberg.org>2025-01-07 00:00:00 +0000
commit829d033a448107f1bc610cf735ce9f7222de564b (patch)
tree25efd26b3cd5d3a3f8e1c9486e2c2da0dce74d0f /src/tangara/ui/ui_fsm.cpp
parent4ad5f1b63761f042734d1cc1eab2649186092ee5 (diff)
downloadtangara-fw-829d033a448107f1bc610cf735ce9f7222de564b.tar.gz
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 <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>
Diffstat (limited to 'src/tangara/ui/ui_fsm.cpp')
-rw-r--r--src/tangara/ui/ui_fsm.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/tangara/ui/ui_fsm.cpp b/src/tangara/ui/ui_fsm.cpp
index 5ea4617e..4a54d974 100644
--- a/src/tangara/ui/ui_fsm.cpp
+++ b/src/tangara/ui/ui_fsm.cpp
@@ -230,6 +230,7 @@ lua::Property UiState::sQueueRandom{false, [](const lua::LuaValue& val) {
return true;
}};
lua::Property UiState::sQueueLoading{false};
+lua::Property UiState::sQueueReady{false};
lua::Property UiState::sVolumeCurrentPct{
0, [](const lua::LuaValue& val) {
@@ -446,12 +447,8 @@ void UiState::react(const audio::QueueUpdate& update) {
sQueuePosition.setDirect(current_pos);
sQueueRandom.setDirect(queue.random());
sQueueRepeatMode.setDirect(queue.repeatMode());
-
- if (update.reason == audio::QueueUpdate::Reason::kBulkLoadingUpdate) {
- sQueueLoading.setDirect(true);
- } else {
- sQueueLoading.setDirect(false);
- }
+ sQueueLoading.setDirect(queue.isLoading());
+ sQueueReady.setDirect(queue.isReady());
}
void UiState::react(const audio::PlaybackUpdate& ev) {
@@ -651,6 +648,7 @@ void Lua::entry() {
{"repeat_mode", &sQueueRepeatMode},
{"random", &sQueueRandom},
{"loading", &sQueueLoading},
+ {"ready", &sQueueReady},
});
registry.AddPropertyModule("volume",
{