summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c25
-rw-r--r--apps/playlist.c29
2 files changed, 31 insertions, 23 deletions
diff --git a/apps/playback.c b/apps/playback.c
index e0cd2c94a1..9d5a6569ae 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -315,6 +315,8 @@ static unsigned int track_event_flags = TEF_NONE; /* (A, O-) */
315/* Pending manual track skip offset */ 315/* Pending manual track skip offset */
316static int skip_offset = 0; /* (A, O) */ 316static int skip_offset = 0; /* (A, O) */
317 317
318static bool track_skip_is_manual = false;
319
318/* Track change notification */ 320/* Track change notification */
319static struct 321static struct
320{ 322{
@@ -2574,9 +2576,9 @@ static void audio_begin_track_change(enum pcm_track_change_type type,
2574 /* Even if the new track is bad, the old track must be finished off */ 2576 /* Even if the new track is bad, the old track must be finished off */
2575 pcmbuf_start_track_change(type); 2577 pcmbuf_start_track_change(type);
2576 2578
2577 bool auto_skip = type != TRACK_CHANGE_MANUAL; 2579 track_skip_is_manual = (type == TRACK_CHANGE_MANUAL);
2578 2580
2579 if (!auto_skip) 2581 if (track_skip_is_manual)
2580 { 2582 {
2581 /* Manual track change happens now */ 2583 /* Manual track change happens now */
2582 audio_finalise_track_change(); 2584 audio_finalise_track_change();
@@ -2595,9 +2597,9 @@ static void audio_begin_track_change(enum pcm_track_change_type type,
2595 return; 2597 return;
2596 2598
2597 /* Everything needed for the codec is ready - start it */ 2599 /* Everything needed for the codec is ready - start it */
2598 if (audio_start_codec(auto_skip)) 2600 if (audio_start_codec(!track_skip_is_manual))
2599 { 2601 {
2600 if (!auto_skip) 2602 if (track_skip_is_manual)
2601 playing_id3_sync(&info, -1, -1); 2603 playing_id3_sync(&info, -1, -1);
2602 return; 2604 return;
2603 } 2605 }
@@ -2924,6 +2926,7 @@ static void audio_stop_playback(void)
2924 2926
2925 skip_pending = TRACK_SKIP_NONE; 2927 skip_pending = TRACK_SKIP_NONE;
2926 track_event_flags = TEF_NONE; 2928 track_event_flags = TEF_NONE;
2929 track_skip_is_manual = false;
2927 2930
2928 /* Close all tracks and mark them NULL */ 2931 /* Close all tracks and mark them NULL */
2929 remove_event(BUFFER_EVENT_REBUFFER, buffer_event_rebuffer_callback); 2932 remove_event(BUFFER_EVENT_REBUFFER, buffer_event_rebuffer_callback);
@@ -2999,6 +3002,11 @@ static void audio_on_skip(void)
2999 /* Manual skip */ 3002 /* Manual skip */
3000 track_event_flags = TEF_NONE; 3003 track_event_flags = TEF_NONE;
3001 3004
3005 if (toskip == 1 && global_settings.repeat_mode == REPEAT_ONE)
3006 {
3007 audio_reset_and_rebuffer(TRACK_LIST_KEEP_CURRENT, 1);
3008 }
3009
3002 /* If there was an auto skip in progress, there will be residual 3010 /* If there was an auto skip in progress, there will be residual
3003 advancement of the playlist and/or track list so compensation will be 3011 advancement of the playlist and/or track list so compensation will be
3004 required in order to end up in the right spot */ 3012 required in order to end up in the right spot */
@@ -3049,7 +3057,7 @@ static void audio_on_skip(void)
3049 track_list_delta += d; 3057 track_list_delta += d;
3050 } 3058 }
3051 } 3059 }
3052 3060 track_skip_is_manual = false;
3053 /* Adjust things by how much the playlist was manually moved */ 3061 /* Adjust things by how much the playlist was manually moved */
3054 playlist_peek_offset -= playlist_delta; 3062 playlist_peek_offset -= playlist_delta;
3055 3063
@@ -3750,10 +3758,11 @@ void audio_resume(void)
3750 audio_queue_send(Q_AUDIO_PAUSE, false); 3758 audio_queue_send(Q_AUDIO_PAUSE, false);
3751} 3759}
3752 3760
3753/* Internal function used by REPEAT_ONE */ 3761/* Internal function used by REPEAT_ONE extern playlist.c */
3754bool audio_pending_track_skip_is_auto(void) 3762bool audio_pending_track_skip_is_manual(void)
3755{ 3763{
3756 return (skip_pending == TRACK_SKIP_AUTO); 3764 logf("Track change is: %s", track_skip_is_manual ? "Manual": "Auto");
3765 return track_skip_is_manual;
3757} 3766}
3758 3767
3759/* Skip the specified number of tracks forward or backward from the current */ 3768/* Skip the specified number of tracks forward or backward from the current */
diff --git a/apps/playlist.c b/apps/playlist.c
index 7c37333bd8..d0aedb5ca1 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -168,10 +168,10 @@
168 168
169static struct playlist_info current_playlist; 169static struct playlist_info current_playlist;
170/* REPEAT_ONE support function from playback.c */ 170/* REPEAT_ONE support function from playback.c */
171extern bool audio_pending_track_skip_is_auto(void); 171extern bool audio_pending_track_skip_is_manual(void);
172static inline bool is_manual_skip(void) 172static inline bool is_manual_skip(void)
173{ 173{
174 return !audio_pending_track_skip_is_auto(); 174 return audio_pending_track_skip_is_manual();
175} 175}
176 176
177/* Directory Cache*/ 177/* Directory Cache*/
@@ -1698,8 +1698,7 @@ static int get_next_index(const struct playlist_info* playlist, int steps,
1698 if (repeat_mode == -1) 1698 if (repeat_mode == -1)
1699 repeat_mode = global_settings.repeat_mode; 1699 repeat_mode = global_settings.repeat_mode;
1700 1700
1701 if ((repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1) || 1701 if (repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1)
1702 (repeat_mode == REPEAT_ONE && is_manual_skip()))
1703 { 1702 {
1704 repeat_mode = REPEAT_ALL; 1703 repeat_mode = REPEAT_ALL;
1705 } 1704 }
@@ -2833,25 +2832,25 @@ int playlist_next(int steps)
2833 playlist_write_lock(playlist); 2832 playlist_write_lock(playlist);
2834 2833
2835 int index; 2834 int index;
2836 int repeat = global_settings.repeat_mode; 2835 int repeat_mode = global_settings.repeat_mode;
2837 2836 if (repeat_mode == REPEAT_ONE)
2837 {
2838 if (is_manual_skip())
2839 repeat_mode = REPEAT_ALL;
2840 }
2838 if (steps > 0) 2841 if (steps > 0)
2839 { 2842 {
2840 if (repeat == REPEAT_ONE && is_manual_skip())
2841 {
2842 repeat = REPEAT_ALL;
2843 }
2844#ifdef AB_REPEAT_ENABLE 2843#ifdef AB_REPEAT_ENABLE
2845 else if (repeat != REPEAT_ONE && repeat != REPEAT_AB) 2844 if (repeat_mode != REPEAT_AB && repeat_mode != REPEAT_ONE)
2846#else 2845#else
2847 else if (repeat != REPEAT_ONE) 2846 if (repeat_mode != REPEAT_ONE)
2848#endif 2847#endif
2849 { 2848 {
2850 int i, j; 2849 int i, j;
2851 /* We need to delete all the queued songs */ 2850 /* We need to delete all the queued songs */
2852 for (i=0, j=steps; i<j; i++) 2851 for (i=0, j=steps; i<j; i++)
2853 { 2852 {
2854 index = get_next_index(playlist, i, repeat); 2853 index = get_next_index(playlist, i, -1);
2855 2854
2856 if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK) 2855 if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK)
2857 { 2856 {
@@ -2861,12 +2860,12 @@ int playlist_next(int steps)
2861 } 2860 }
2862 } 2861 }
2863 } /*steps > 0*/ 2862 } /*steps > 0*/
2864 index = get_next_index(playlist, steps, repeat); 2863 index = get_next_index(playlist, steps, repeat_mode);
2865 2864
2866 if (index < 0) 2865 if (index < 0)
2867 { 2866 {
2868 /* end of playlist... or is it */ 2867 /* end of playlist... or is it */
2869 if (repeat == REPEAT_SHUFFLE && playlist->amount > 1) 2868 if (repeat_mode == REPEAT_SHUFFLE && playlist->amount > 1)
2870 { 2869 {
2871 /* Repeat shuffle mode. Re-shuffle playlist and resume play */ 2870 /* Repeat shuffle mode. Re-shuffle playlist and resume play */
2872 playlist->first_index = 0; 2871 playlist->first_index = 0;