summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2023-09-21 10:37:29 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2023-09-23 00:52:38 -0400
commitfcc82dfdca470e49d864da9af4fa9573ad6e54fe (patch)
tree588e9f63fa321d87567035a136bbd5328ea3b47d
parenta45204f5df18843674c8072f95817e24aed4ff27 (diff)
downloadrockbox-fcc82dfdca.tar.gz
rockbox-fcc82dfdca.zip
[BugFix] REPEAT_ONE manual track skip
Still having problems with determining the type of track change lets try just watching the audio_next/prev functions Change-Id: Ie4233ff4d4bf49792a6549d7bcd169ff4b1afd20
-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-) */
/* Pending manual track skip offset */
static int skip_offset = 0; /* (A, O) */
+static bool track_skip_is_manual = false;
+
/* Track change notification */
static struct
{
@@ -2574,9 +2576,9 @@ static void audio_begin_track_change(enum pcm_track_change_type type,
/* Even if the new track is bad, the old track must be finished off */
pcmbuf_start_track_change(type);
- bool auto_skip = type != TRACK_CHANGE_MANUAL;
+ track_skip_is_manual = (type == TRACK_CHANGE_MANUAL);
- if (!auto_skip)
+ if (track_skip_is_manual)
{
/* Manual track change happens now */
audio_finalise_track_change();
@@ -2595,9 +2597,9 @@ static void audio_begin_track_change(enum pcm_track_change_type type,
return;
/* Everything needed for the codec is ready - start it */
- if (audio_start_codec(auto_skip))
+ if (audio_start_codec(!track_skip_is_manual))
{
- if (!auto_skip)
+ if (track_skip_is_manual)
playing_id3_sync(&info, -1, -1);
return;
}
@@ -2924,6 +2926,7 @@ static void audio_stop_playback(void)
skip_pending = TRACK_SKIP_NONE;
track_event_flags = TEF_NONE;
+ track_skip_is_manual = false;
/* Close all tracks and mark them NULL */
remove_event(BUFFER_EVENT_REBUFFER, buffer_event_rebuffer_callback);
@@ -2999,6 +3002,11 @@ static void audio_on_skip(void)
/* Manual skip */
track_event_flags = TEF_NONE;
+ if (toskip == 1 && global_settings.repeat_mode == REPEAT_ONE)
+ {
+ audio_reset_and_rebuffer(TRACK_LIST_KEEP_CURRENT, 1);
+ }
+
/* If there was an auto skip in progress, there will be residual
advancement of the playlist and/or track list so compensation will be
required in order to end up in the right spot */
@@ -3049,7 +3057,7 @@ static void audio_on_skip(void)
track_list_delta += d;
}
}
-
+ track_skip_is_manual = false;
/* Adjust things by how much the playlist was manually moved */
playlist_peek_offset -= playlist_delta;
@@ -3750,10 +3758,11 @@ void audio_resume(void)
audio_queue_send(Q_AUDIO_PAUSE, false);
}
-/* Internal function used by REPEAT_ONE */
-bool audio_pending_track_skip_is_auto(void)
+/* Internal function used by REPEAT_ONE extern playlist.c */
+bool audio_pending_track_skip_is_manual(void)
{
- return (skip_pending == TRACK_SKIP_AUTO);
+ logf("Track change is: %s", track_skip_is_manual ? "Manual": "Auto");
+ return track_skip_is_manual;
}
/* 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 @@
static struct playlist_info current_playlist;
/* REPEAT_ONE support function from playback.c */
-extern bool audio_pending_track_skip_is_auto(void);
+extern bool audio_pending_track_skip_is_manual(void);
static inline bool is_manual_skip(void)
{
- return !audio_pending_track_skip_is_auto();
+ return audio_pending_track_skip_is_manual();
}
/* Directory Cache*/
@@ -1698,8 +1698,7 @@ static int get_next_index(const struct playlist_info* playlist, int steps,
if (repeat_mode == -1)
repeat_mode = global_settings.repeat_mode;
- if ((repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1) ||
- (repeat_mode == REPEAT_ONE && is_manual_skip()))
+ if (repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1)
{
repeat_mode = REPEAT_ALL;
}
@@ -2833,25 +2832,25 @@ int playlist_next(int steps)
playlist_write_lock(playlist);
int index;
- int repeat = global_settings.repeat_mode;
-
+ int repeat_mode = global_settings.repeat_mode;
+ if (repeat_mode == REPEAT_ONE)
+ {
+ if (is_manual_skip())
+ repeat_mode = REPEAT_ALL;
+ }
if (steps > 0)
{
- if (repeat == REPEAT_ONE && is_manual_skip())
- {
- repeat = REPEAT_ALL;
- }
#ifdef AB_REPEAT_ENABLE
- else if (repeat != REPEAT_ONE && repeat != REPEAT_AB)
+ if (repeat_mode != REPEAT_AB && repeat_mode != REPEAT_ONE)
#else
- else if (repeat != REPEAT_ONE)
+ if (repeat_mode != REPEAT_ONE)
#endif
{
int i, j;
/* We need to delete all the queued songs */
for (i=0, j=steps; i<j; i++)
{
- index = get_next_index(playlist, i, repeat);
+ index = get_next_index(playlist, i, -1);
if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK)
{
@@ -2861,12 +2860,12 @@ int playlist_next(int steps)
}
}
} /*steps > 0*/
- index = get_next_index(playlist, steps, repeat);
+ index = get_next_index(playlist, steps, repeat_mode);
if (index < 0)
{
/* end of playlist... or is it */
- if (repeat == REPEAT_SHUFFLE && playlist->amount > 1)
+ if (repeat_mode == REPEAT_SHUFFLE && playlist->amount > 1)
{
/* Repeat shuffle mode. Re-shuffle playlist and resume play */
playlist->first_index = 0;