From 287c4bfb26a3fc6a94d7fd10c8d2b1a90ebe8db5 Mon Sep 17 00:00:00 2001 From: malcircuit Date: Mon, 16 Dec 2024 10:43:47 -0600 Subject: [PATCH] Make now-playing queue circular --- src/tangara/audio/track_queue.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tangara/audio/track_queue.cpp b/src/tangara/audio/track_queue.cpp index 05ac0b95..0af8bee0 100644 --- a/src/tangara/audio/track_queue.cpp +++ b/src/tangara/audio/track_queue.cpp @@ -304,7 +304,10 @@ auto TrackQueue::next(Reason r) -> void { position_ = shuffle_->current(); } else { if (position_ + 1 < totalSize()) { - position_++; + position_++; // Next track + } + else { + position_ = 0; // Go to beginning } } @@ -327,6 +330,9 @@ auto TrackQueue::previous() -> void { if (position_ > 0) { position_--; } + else { + position_ = totalSize(); + } } goTo(position_); }