Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

[Feature] Skip to next file even if loop one is set.

repeat one till manually skipped

https://forums.rockbox.org/index.php/topic,54218.0.html

Change-Id: If2ea1cd892531c735c30c428dea3678806283a3b

authored by

William Wilgus and committed by
William Wilgus
f96f7cd9 9242e4ca

+48 -21
+46 -19
apps/playlist.c
··· 167 167 #define PLAYLIST_SKIPPED 0x10000000 168 168 169 169 static struct playlist_info current_playlist; 170 + /* REPEAT_ONE support functions */ 171 + static long last_manual_skip_tick = 0; 170 172 173 + static inline bool is_manual_skip(void) 174 + { 175 + return (last_manual_skip_tick + HZ/2 > current_tick); 176 + } 177 + 178 + static void track_change_callback(unsigned short id, void *param) 179 + { 180 + (void)id; 181 + unsigned int flags = ((struct track_event *)param)->flags; 182 + if ((flags & TEF_AUTO_SKIP) != TEF_AUTO_SKIP) 183 + { 184 + last_manual_skip_tick = current_tick; 185 + } 186 + } 187 + 188 + /* Directory Cache*/ 171 189 static void dc_init_filerefs(struct playlist_info *playlist, 172 190 int start, int count) 173 191 { ··· 1691 1709 if (repeat_mode == -1) 1692 1710 repeat_mode = global_settings.repeat_mode; 1693 1711 1694 - if (repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1) 1712 + if ((repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1) || 1713 + (repeat_mode == REPEAT_ONE && is_manual_skip())) 1714 + { 1695 1715 repeat_mode = REPEAT_ALL; 1716 + } 1696 1717 1697 1718 steps = calculate_step_count(playlist, steps); 1698 1719 switch (repeat_mode) ··· 1964 1985 1965 1986 dc_thread_start(&current_playlist, false); 1966 1987 #endif /* HAVE_DIRCACHE */ 1988 + add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_change_callback); 1967 1989 } 1968 1990 1969 1991 /* ··· 2823 2845 playlist_write_lock(playlist); 2824 2846 2825 2847 int index; 2848 + int repeat = global_settings.repeat_mode; 2826 2849 2827 - if ( (steps > 0) 2850 + if (steps > 0) 2851 + { 2852 + if (repeat == REPEAT_ONE && is_manual_skip()) 2853 + { 2854 + repeat = REPEAT_ALL; 2855 + } 2828 2856 #ifdef AB_REPEAT_ENABLE 2829 - && (global_settings.repeat_mode != REPEAT_AB) 2857 + else if (repeat != REPEAT_ONE && repeat != REPEAT_AB) 2858 + #else 2859 + else if (repeat != REPEAT_ONE) 2830 2860 #endif 2831 - && (global_settings.repeat_mode != REPEAT_ONE) ) 2832 - { 2833 - int i, j; 2834 - 2835 - /* We need to delete all the queued songs */ 2836 - for (i=0, j=steps; i<j; i++) 2837 2861 { 2838 - index = get_next_index(playlist, i, -1); 2839 - 2840 - if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK) 2862 + int i, j; 2863 + /* We need to delete all the queued songs */ 2864 + for (i=0, j=steps; i<j; i++) 2841 2865 { 2842 - remove_track_unlocked(playlist, index, true); 2843 - steps--; /* one less track */ 2866 + index = get_next_index(playlist, i, repeat); 2867 + 2868 + if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK) 2869 + { 2870 + remove_track_unlocked(playlist, index, true); 2871 + steps--; /* one less track */ 2872 + } 2844 2873 } 2845 2874 } 2846 - } 2847 - 2848 - index = get_next_index(playlist, steps, -1); 2875 + } /*steps > 0*/ 2876 + index = get_next_index(playlist, steps, repeat); 2849 2877 2850 2878 if (index < 0) 2851 2879 { 2852 2880 /* end of playlist... or is it */ 2853 - if (global_settings.repeat_mode == REPEAT_SHUFFLE && 2854 - playlist->amount > 1) 2881 + if (repeat == REPEAT_SHUFFLE && playlist->amount > 1) 2855 2882 { 2856 2883 /* Repeat shuffle mode. Re-shuffle playlist and resume play */ 2857 2884 playlist->first_index = 0;
+2 -2
manual/configure_rockbox/playback_options.tex
··· 26 26 \item[All.] The current playlist will repeat when it is finished. 27 27 28 28 % 29 - \item[One. ]Repeat one track over and over. 29 + \item[One. ]Repeat one track over and over unless track is manually skipped. 30 30 % 31 31 \item[Shuffle.] When the current playlist has finished playing, it will 32 32 be shuffled and then repeated. ··· 324 324 To prefer loading album art that is stored in a separate image file, set to 325 325 \setting{Prefer Image File}. The default behavior is to 326 326 \setting{Prefer Embedded} album art. 327 - } 327 + }