summaryrefslogtreecommitdiff
path: root/apps/onplay.c
diff options
context:
space:
mode:
authorPaul Sauro <olsroparadise@proton.me>2024-08-28 22:55:52 +0200
committerWilliam Wilgus <me.theuser@yahoo.com>2024-08-31 10:44:20 -0400
commitc16dbbfd1fb7bf4bc268a4693bbed21497456b30 (patch)
tree3faea1f6d294f5835f72075b9a27e996525aef0a /apps/onplay.c
parentf6e8c20188276251d8b3ec512be81f2460ce39e7 (diff)
downloadrockbox-c16dbbfd1fb7bf4bc268a4693bbed21497456b30.tar.gz
rockbox-c16dbbfd1fb7bf4bc268a4693bbed21497456b30.zip
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
Diffstat (limited to 'apps/onplay.c')
-rw-r--r--apps/onplay.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/apps/onplay.c b/apps/onplay.c
index 4f748204df..045af275bc 100644
--- a/apps/onplay.c
+++ b/apps/onplay.c
@@ -302,7 +302,7 @@ static int add_to_playlist(void* arg)
302 302
303 /* warn if replacing the playlist */ 303 /* warn if replacing the playlist */
304 if (new_playlist && !warn_on_pl_erase()) 304 if (new_playlist && !warn_on_pl_erase())
305 return 0; 305 return 1;
306 306
307 splash(0, ID2P(LANG_WAIT)); 307 splash(0, ID2P(LANG_WAIT));
308 308
@@ -340,7 +340,7 @@ static int add_to_playlist(void* arg)
340 } 340 }
341 341
342 playlist_set_modified(NULL, true); 342 playlist_set_modified(NULL, true);
343 return false; 343 return 0;
344} 344}
345 345
346static bool view_playlist(void) 346static bool view_playlist(void)
@@ -1255,7 +1255,7 @@ static int execute_hotkey(bool is_wps)
1255} 1255}
1256#endif /* HOTKEY */ 1256#endif /* HOTKEY */
1257 1257
1258int onplay(char* file, int attr, int from_context, bool hotkey) 1258int onplay(char* file, int attr, int from_context, bool hotkey, int customaction)
1259{ 1259{
1260 const struct menu_item_ex *menu; 1260 const struct menu_item_ex *menu;
1261 onplay_result = ONPLAY_OK; 1261 onplay_result = ONPLAY_OK;
@@ -1294,6 +1294,13 @@ int onplay(char* file, int attr, int from_context, bool hotkey)
1294#else 1294#else
1295 (void)hotkey; 1295 (void)hotkey;
1296#endif 1296#endif
1297 if (customaction == ONPLAY_CUSTOMACTION_SHUFFLE_SONGS) {
1298 int returnCode = add_to_playlist(&addtopl_replace_shuffled);
1299 if (returnCode == 1)
1300 // User did not want to erase his current playlist, so let's show again the database main menu
1301 return ONPLAY_RELOAD_DIR;
1302 return ONPLAY_START_PLAY;
1303 }
1297 1304
1298 push_current_activity(ACTIVITY_CONTEXTMENU); 1305 push_current_activity(ACTIVITY_CONTEXTMENU);
1299 if (from_context == CONTEXT_WPS) 1306 if (from_context == CONTEXT_WPS)