···167167#define PLAYLIST_SKIPPED 0x10000000
168168169169static struct playlist_info current_playlist;
170170+/* REPEAT_ONE support functions */
171171+static long last_manual_skip_tick = 0;
170172173173+static inline bool is_manual_skip(void)
174174+{
175175+ return (last_manual_skip_tick + HZ/2 > current_tick);
176176+}
177177+178178+static void track_change_callback(unsigned short id, void *param)
179179+{
180180+ (void)id;
181181+ unsigned int flags = ((struct track_event *)param)->flags;
182182+ if ((flags & TEF_AUTO_SKIP) != TEF_AUTO_SKIP)
183183+ {
184184+ last_manual_skip_tick = current_tick;
185185+ }
186186+}
187187+188188+/* Directory Cache*/
171189static void dc_init_filerefs(struct playlist_info *playlist,
172190 int start, int count)
173191{
···16911709 if (repeat_mode == -1)
16921710 repeat_mode = global_settings.repeat_mode;
1693171116941694- if (repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1)
17121712+ if ((repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1) ||
17131713+ (repeat_mode == REPEAT_ONE && is_manual_skip()))
17141714+ {
16951715 repeat_mode = REPEAT_ALL;
17161716+ }
1696171716971718 steps = calculate_step_count(playlist, steps);
16981719 switch (repeat_mode)
···1964198519651986 dc_thread_start(¤t_playlist, false);
19661987#endif /* HAVE_DIRCACHE */
19881988+ add_event(PLAYBACK_EVENT_TRACK_CHANGE, track_change_callback);
19671989}
1968199019691991/*
···28232845 playlist_write_lock(playlist);
2824284628252847 int index;
28482848+ int repeat = global_settings.repeat_mode;
2826284928272827- if ( (steps > 0)
28502850+ if (steps > 0)
28512851+ {
28522852+ if (repeat == REPEAT_ONE && is_manual_skip())
28532853+ {
28542854+ repeat = REPEAT_ALL;
28552855+ }
28282856#ifdef AB_REPEAT_ENABLE
28292829- && (global_settings.repeat_mode != REPEAT_AB)
28572857+ else if (repeat != REPEAT_ONE && repeat != REPEAT_AB)
28582858+#else
28592859+ else if (repeat != REPEAT_ONE)
28302860#endif
28312831- && (global_settings.repeat_mode != REPEAT_ONE) )
28322832- {
28332833- int i, j;
28342834-28352835- /* We need to delete all the queued songs */
28362836- for (i=0, j=steps; i<j; i++)
28372861 {
28382838- index = get_next_index(playlist, i, -1);
28392839-28402840- if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK)
28622862+ int i, j;
28632863+ /* We need to delete all the queued songs */
28642864+ for (i=0, j=steps; i<j; i++)
28412865 {
28422842- remove_track_unlocked(playlist, index, true);
28432843- steps--; /* one less track */
28662866+ index = get_next_index(playlist, i, repeat);
28672867+28682868+ if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK)
28692869+ {
28702870+ remove_track_unlocked(playlist, index, true);
28712871+ steps--; /* one less track */
28722872+ }
28442873 }
28452874 }
28462846- }
28472847-28482848- index = get_next_index(playlist, steps, -1);
28752875+ } /*steps > 0*/
28762876+ index = get_next_index(playlist, steps, repeat);
2849287728502878 if (index < 0)
28512879 {
28522880 /* end of playlist... or is it */
28532853- if (global_settings.repeat_mode == REPEAT_SHUFFLE &&
28542854- playlist->amount > 1)
28812881+ if (repeat == REPEAT_SHUFFLE && playlist->amount > 1)
28552882 {
28562883 /* Repeat shuffle mode. Re-shuffle playlist and resume play */
28572884 playlist->first_index = 0;
+2-2
manual/configure_rockbox/playback_options.tex
···2626 \item[All.] The current playlist will repeat when it is finished.
27272828 %
2929- \item[One. ]Repeat one track over and over.
2929+ \item[One. ]Repeat one track over and over unless track is manually skipped.
3030 %
3131 \item[Shuffle.] When the current playlist has finished playing, it will
3232 be shuffled and then repeated.
···324324 To prefer loading album art that is stored in a separate image file, set to
325325 \setting{Prefer Image File}. The default behavior is to
326326 \setting{Prefer Embedded} album art.
327327-}327327+}