1
0
Fork 0
forked from len0rd/rockbox

Reworks to the shuffle system to improve performance and allow fast shuffling from a big library (but this work for all database views)

This improvement brings a huge performance improvement to start a random mix of your library. Previously, the only way to do this was to increase the size of a playlist with absurd sizes number. Now it will respect the limitation but will insert random songs from the current view.

Database: Add true random songs in playlist if it is gonna exceed its maximum capacity

More context is available here : https://www.reddit.com/r/rockbox/comments/1ez0mq4/i_developped_true_full_library_shuffle_for/

Also :
- Improved layout in the DB browser
- New default max playlists capacity is now 2000 on old PortalPlayer targets to give a better user experience and not having to wait dozens of seconds while creating a playlist
- "Show insert shuffled" option is now true by default
- Add a new shortcut to play all songs shuffled in the DB browser
- Now the feature is fully optional and enabled only on targets that have more than 2MB of RAM
- Add entries about this feature in the manual to explain it to the users
Change-Id: I1aebaf7ebcff2bf907080f1861027d530619097c

Change-Id: I3354923b148eeef1975171990e814a1a505d1df0
This commit is contained in:
Paul Sauro 2024-08-28 22:55:52 +02:00 committed by William Wilgus
parent f6e8c20188
commit c16dbbfd1f
13 changed files with 264 additions and 89 deletions

View file

@ -735,6 +735,17 @@ static int dirbrowse(void)
oldbutton = button;
gui_synclist_do_button(&tree_lists, &button);
tc.selected_item = gui_synclist_get_sel_pos(&tree_lists);
int customaction = ONPLAY_NO_CUSTOMACTION;
bool do_restore_display = true;
#ifdef HAVE_TAGCACHE
if (id3db && (button == ACTION_STD_OK || button == ACTION_STD_CONTEXT)) {
customaction = tagtree_get_custom_action(&tc);
if (customaction == ONPLAY_CUSTOMACTION_SHUFFLE_SONGS) {
button = ACTION_STD_CONTEXT; /** The code to insert shuffled is on the context branch of the switch so we always go here */
do_restore_display = false;
}
}
#endif
switch ( button ) {
case ACTION_STD_OK:
/* nothing to do if no files to display */
@ -773,7 +784,7 @@ static int dirbrowse(void)
default:
break;
}
restore = true;
restore = do_restore_display;
break;
case ACTION_STD_CANCEL:
@ -798,12 +809,12 @@ static int dirbrowse(void)
if (ft_exit(&tc) == 3)
exit_func = true;
restore = true;
restore = do_restore_display;
break;
case ACTION_TREE_STOP:
if (list_stop_handler())
restore = true;
restore = do_restore_display;
break;
case ACTION_STD_MENU:
@ -851,7 +862,7 @@ static int dirbrowse(void)
skin_update(CUSTOM_STATUSBAR, i, SKIN_REFRESH_ALL);
}
restore = true;
restore = do_restore_display;
break;
}
#endif
@ -872,7 +883,7 @@ static int dirbrowse(void)
break;
if(!numentries)
onplay_result = onplay(NULL, 0, curr_context, hotkey);
onplay_result = onplay(NULL, 0, curr_context, hotkey, customaction);
else {
#ifdef HAVE_TAGCACHE
if (id3db)
@ -902,7 +913,7 @@ static int dirbrowse(void)
ft_assemble_path(buf, sizeof(buf), currdir, entry->name);
}
onplay_result = onplay(buf, attr, curr_context, hotkey);
onplay_result = onplay(buf, attr, curr_context, hotkey, customaction);
}
switch (onplay_result)
{
@ -911,7 +922,7 @@ static int dirbrowse(void)
break;
case ONPLAY_OK:
restore = true;
restore = do_restore_display;
break;
case ONPLAY_RELOAD_DIR:
@ -988,7 +999,7 @@ static int dirbrowse(void)
lastfilter = *tc.dirfilter;
lastsortcase = global_settings.sort_case;
restore = true;
restore = do_restore_display;
}
if (exit_func)