diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2021-11-30 21:02:32 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-12-11 11:43:39 -0500 |
commit | 69d08be0830966175b92d68ece8ad0119898fef2 (patch) | |
tree | d93941dfe1e33f294a073c82dd00cd90e1a259fb | |
parent | 8060c797752c3addbaa8c75e84721fbd3127860f (diff) | |
download | rockbox-69d08be0830966175b92d68ece8ad0119898fef2.tar.gz rockbox-69d08be0830966175b92d68ece8ad0119898fef2.zip |
Additional Single Mode options
In addition to the existing behavior of pausing
after each song, this adds options to pause
after playing current:
Album,
Album Artist,
Artist,
Composer,
Grouping / Work, or
Genre.
Allows you, for example, to only listen to the
remaining movements of a classical work
without having to purge your playlist of any
upcoming songs.
Change-Id: If18f4a5d139320026cc5fcc9adf29dd8e4e028a8
-rw-r--r-- | apps/pcmbuf.c | 2 | ||||
-rw-r--r-- | apps/playback.c | 45 | ||||
-rw-r--r-- | apps/settings.h | 15 | ||||
-rw-r--r-- | apps/settings_list.c | 13 | ||||
-rw-r--r-- | manual/appendix/config_file_options.tex | 3 | ||||
-rw-r--r-- | manual/configure_rockbox/playback_options.tex | 9 |
6 files changed, 76 insertions, 11 deletions
diff --git a/apps/pcmbuf.c b/apps/pcmbuf.c index c4164c3b4b..8718d730fb 100644 --- a/apps/pcmbuf.c +++ b/apps/pcmbuf.c | |||
@@ -741,7 +741,7 @@ void pcmbuf_start_track_change(enum pcm_track_change_type type) | |||
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | if (auto_skip && global_settings.single_mode && !global_settings.party_mode) | 744 | if (auto_skip && global_settings.single_mode != SINGLE_MODE_OFF && !global_settings.party_mode) |
745 | crossfade = false; | 745 | crossfade = false; |
746 | 746 | ||
747 | if (crossfade) | 747 | if (crossfade) |
diff --git a/apps/playback.c b/apps/playback.c index 5d980b5634..4162d9b647 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -2367,6 +2367,31 @@ static void audio_on_handle_finished(int hid) | |||
2367 | } | 2367 | } |
2368 | } | 2368 | } |
2369 | 2369 | ||
2370 | static inline char* single_mode_get_id3_tag(struct mp3entry *id3) | ||
2371 | { | ||
2372 | struct mp3entry *valid_id3 = valid_mp3entry(id3); | ||
2373 | if (valid_id3 == NULL) | ||
2374 | return NULL; | ||
2375 | |||
2376 | switch (global_settings.single_mode) | ||
2377 | { | ||
2378 | case SINGLE_MODE_ALBUM: | ||
2379 | return valid_id3->album; | ||
2380 | case SINGLE_MODE_ALBUM_ARTIST: | ||
2381 | return valid_id3->albumartist; | ||
2382 | case SINGLE_MODE_ARTIST: | ||
2383 | return valid_id3->artist; | ||
2384 | case SINGLE_MODE_COMPOSER: | ||
2385 | return valid_id3->composer; | ||
2386 | case SINGLE_MODE_GROUPING: | ||
2387 | return valid_id3->grouping; | ||
2388 | case SINGLE_MODE_GENRE: | ||
2389 | return valid_id3->genre_string; | ||
2390 | } | ||
2391 | |||
2392 | return NULL; | ||
2393 | } | ||
2394 | |||
2370 | /* Called to make an outstanding track skip the current track and to send the | 2395 | /* Called to make an outstanding track skip the current track and to send the |
2371 | transition events */ | 2396 | transition events */ |
2372 | static void audio_finalise_track_change(void) | 2397 | static void audio_finalise_track_change(void) |
@@ -2422,15 +2447,27 @@ static void audio_finalise_track_change(void) | |||
2422 | track_id3 = bufgetid3(info.id3_hid); | 2447 | track_id3 = bufgetid3(info.id3_hid); |
2423 | } | 2448 | } |
2424 | 2449 | ||
2425 | id3_write(PLAYING_ID3, track_id3); | 2450 | if (SINGLE_MODE_OFF != global_settings.single_mode && global_settings.party_mode == 0 && |
2451 | ((skip_pending == TRACK_SKIP_AUTO) || (skip_pending == TRACK_SKIP_AUTO_NEW_PLAYLIST))) | ||
2452 | { | ||
2453 | bool single_mode_do_pause = true; | ||
2454 | if (SINGLE_MODE_TRACK != global_settings.single_mode) | ||
2455 | { | ||
2456 | char *previous_tag = single_mode_get_id3_tag(id3_get(PLAYING_ID3)); | ||
2457 | char *new_tag = single_mode_get_id3_tag(track_id3); | ||
2458 | single_mode_do_pause = previous_tag == NULL || | ||
2459 | new_tag == NULL || | ||
2460 | strcmp(previous_tag, new_tag) != 0; | ||
2461 | } | ||
2426 | 2462 | ||
2427 | if (global_settings.single_mode) | 2463 | if (single_mode_do_pause) |
2428 | if ( ((skip_pending == TRACK_SKIP_AUTO) || (skip_pending == TRACK_SKIP_AUTO_NEW_PLAYLIST)) | ||
2429 | && (global_settings.party_mode == 0) ) | ||
2430 | { | 2464 | { |
2431 | play_status = PLAY_PAUSED; | 2465 | play_status = PLAY_PAUSED; |
2432 | pcmbuf_pause(true); | 2466 | pcmbuf_pause(true); |
2433 | } | 2467 | } |
2468 | } | ||
2469 | |||
2470 | id3_write(PLAYING_ID3, track_id3); | ||
2434 | 2471 | ||
2435 | /* The skip is technically over */ | 2472 | /* The skip is technically over */ |
2436 | skip_pending = TRACK_SKIP_NONE; | 2473 | skip_pending = TRACK_SKIP_NONE; |
diff --git a/apps/settings.h b/apps/settings.h index 79b47f6a0f..b3c31476e3 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -108,6 +108,18 @@ enum | |||
108 | NUM_REPEAT_MODES | 108 | NUM_REPEAT_MODES |
109 | }; | 109 | }; |
110 | 110 | ||
111 | /* single mode options */ | ||
112 | enum { | ||
113 | SINGLE_MODE_OFF = 0, | ||
114 | SINGLE_MODE_TRACK, | ||
115 | SINGLE_MODE_ALBUM, | ||
116 | SINGLE_MODE_ALBUM_ARTIST, | ||
117 | SINGLE_MODE_ARTIST, | ||
118 | SINGLE_MODE_COMPOSER, | ||
119 | SINGLE_MODE_GROUPING, | ||
120 | SINGLE_MODE_GENRE | ||
121 | }; | ||
122 | |||
111 | enum | 123 | enum |
112 | { | 124 | { |
113 | QUEUE_HIDE = 0, | 125 | QUEUE_HIDE = 0, |
@@ -476,7 +488,8 @@ struct user_settings | |||
476 | int default_codepage; /* set default codepage for tag conversion */ | 488 | int default_codepage; /* set default codepage for tag conversion */ |
477 | bool hold_lr_for_scroll_in_list; /* hold L/R scrolls the list left/right */ | 489 | bool hold_lr_for_scroll_in_list; /* hold L/R scrolls the list left/right */ |
478 | bool play_selected; /* Plays selected file even in shuffle mode */ | 490 | bool play_selected; /* Plays selected file even in shuffle mode */ |
479 | bool single_mode; /* single mode - stop after every track */ | 491 | int single_mode; /* single mode - stop after every track, album, album artist, |
492 | artist, composer, work, or genre */ | ||
480 | bool party_mode; /* party mode - unstoppable music */ | 493 | bool party_mode; /* party mode - unstoppable music */ |
481 | bool audioscrobbler; /* Audioscrobbler logging */ | 494 | bool audioscrobbler; /* Audioscrobbler logging */ |
482 | bool cuesheet; | 495 | bool cuesheet; |
diff --git a/apps/settings_list.c b/apps/settings_list.c index f93b3c272a..982b483874 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c | |||
@@ -1243,7 +1243,18 @@ const struct settings_list settings[] = { | |||
1243 | #endif | 1243 | #endif |
1244 | /* more playback */ | 1244 | /* more playback */ |
1245 | OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL), | 1245 | OFFON_SETTING(0,play_selected,LANG_PLAY_SELECTED,true,"play selected",NULL), |
1246 | OFFON_SETTING(0,single_mode,LANG_SINGLE_MODE,false,"single mode",NULL), | 1246 | CHOICE_SETTING(0, single_mode, LANG_SINGLE_MODE, 0, |
1247 | "single mode", | ||
1248 | "off,track,album,album artist,artist,composer,work,genre", | ||
1249 | NULL, 8, | ||
1250 | ID2P(LANG_OFF), | ||
1251 | ID2P(LANG_TRACK), | ||
1252 | ID2P(LANG_ID3_ALBUM), | ||
1253 | ID2P(LANG_ID3_ALBUMARTIST), | ||
1254 | ID2P(LANG_ID3_ARTIST), | ||
1255 | ID2P(LANG_ID3_COMPOSER), | ||
1256 | ID2P(LANG_ID3_GROUPING), | ||
1257 | ID2P(LANG_ID3_GENRE)), | ||
1247 | OFFON_SETTING(0,party_mode,LANG_PARTY_MODE,false,"party mode",NULL), | 1258 | OFFON_SETTING(0,party_mode,LANG_PARTY_MODE,false,"party mode",NULL), |
1248 | OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL), | 1259 | OFFON_SETTING(0,fade_on_stop,LANG_FADE_ON_STOP,true,"volume fade",NULL), |
1249 | INT_SETTING(F_TIME_SETTING, ff_rewind_min_step, LANG_FFRW_STEP, 1, | 1260 | INT_SETTING(F_TIME_SETTING, ff_rewind_min_step, LANG_FFRW_STEP, 1, |
diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex index 257a3bc48e..40945e6397 100644 --- a/manual/appendix/config_file_options.tex +++ b/manual/appendix/config_file_options.tex | |||
@@ -37,7 +37,8 @@ | |||
37 | repeat & off, all, one, shuffle, ab | 37 | repeat & off, all, one, shuffle, ab |
38 | & N/A\\ | 38 | & N/A\\ |
39 | play selected & on, off & N/A\\ | 39 | play selected & on, off & N/A\\ |
40 | single mode & on, off & N/A\\ | 40 | single mode & off, track, album, album artist, artist, composer, work, genre |
41 | & N/A\\ | ||
41 | party mode & on, off & N/A\\ | 42 | party mode & on, off & N/A\\ |
42 | scan min step & 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 25, 30, 45, 60 | 43 | scan min step & 1, 2, 3, 4, 5, 6, 8, 10, 15, 20, 25, 30, 45, 60 |
43 | & s\\ | 44 | & s\\ |
diff --git a/manual/configure_rockbox/playback_options.tex b/manual/configure_rockbox/playback_options.tex index f9f50593e6..6c8f5de316 100644 --- a/manual/configure_rockbox/playback_options.tex +++ b/manual/configure_rockbox/playback_options.tex | |||
@@ -83,9 +83,12 @@ you to configure settings related to audio playback. | |||
83 | playback, and fade in when you resume playback. | 83 | playback, and fade in when you resume playback. |
84 | 84 | ||
85 | \section{Single Mode} | 85 | \section{Single Mode} |
86 | If the Single Mode option is set to \setting{Yes}, your music | 86 | If the Single Mode option is set to \setting{Track}, your music |
87 | will pause at every automatic track change. Crossfade on track | 87 | will pause at every automatic track change. |
88 | change will be ignored if this setting is enabled. | 88 | If it is set to \setting{Album}, \setting{Album Artist}, \setting{Artist}, |
89 | \setting{Composer}, \setting{Work}, or \setting{Genre}, | ||
90 | your music will pause at the next track change where this tag also | ||
91 | changes. Crossfade on track change will be ignored if this setting is enabled. | ||
89 | 92 | ||
90 | \section{Party Mode} | 93 | \section{Party Mode} |
91 | Enables unstoppable music playback. When new songs are | 94 | Enables unstoppable music playback. When new songs are |