From 436e64e09eee2b83daa0c91835305fec2eec1a3f Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Mon, 15 Feb 2021 15:05:56 +0100 Subject: Fix playback queue bug when "Insert Next" is used with multiple songs at once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After using “Insert Next” to insert multiple songs at once (e.g. an album from the database browser or folder from the file browser), subsequent Insert operations will incorrectly insert items after the first song of all items that were previously inserted, instead of after the last song of the previously inserted items. A bug fix was originally written by Costas Calamvokis for the file browser only. I adopted the original fix and added code analogous to it so that it works from the database browser as well. See FS#7898, FS#7363 or this forum post for more info: https://forums.rockbox.org/index.php/topic,53741.0.html Change-Id: Ie2718e136df0b340000f7a171e9e806cf23a27b4 --- apps/tagtree.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'apps/tagtree.c') diff --git a/apps/tagtree.c b/apps/tagtree.c index f006baa581..97e0c67b62 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -2018,18 +2018,9 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue } } - if (position == PLAYLIST_INSERT_FIRST) - { - from = c->filesindir - 1; - to = -1; - direction = -1; - } - else - { - from = 0; - to = c->filesindir; - direction = 1; - } + from = 0; + to = c->filesindir; + direction = 1; for (i = from; i != to; i += direction) { @@ -2049,6 +2040,11 @@ static bool insert_all_playlist(struct tree_context *c, int position, bool queue break; } yield(); + + if (position == PLAYLIST_INSERT_FIRST) + { + position = PLAYLIST_INSERT; + } } playlist_sync(NULL); tagcache_search_finish(&tcs); -- cgit v1.2.3