mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
[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
This commit is contained in:
parent
a45204f5df
commit
fcc82dfdca
2 changed files with 31 additions and 23 deletions
|
@ -315,6 +315,8 @@ static unsigned int track_event_flags = TEF_NONE; /* (A, O-) */
|
||||||
/* Pending manual track skip offset */
|
/* Pending manual track skip offset */
|
||||||
static int skip_offset = 0; /* (A, O) */
|
static int skip_offset = 0; /* (A, O) */
|
||||||
|
|
||||||
|
static bool track_skip_is_manual = false;
|
||||||
|
|
||||||
/* Track change notification */
|
/* Track change notification */
|
||||||
static struct
|
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 */
|
/* Even if the new track is bad, the old track must be finished off */
|
||||||
pcmbuf_start_track_change(type);
|
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 */
|
/* Manual track change happens now */
|
||||||
audio_finalise_track_change();
|
audio_finalise_track_change();
|
||||||
|
@ -2595,9 +2597,9 @@ static void audio_begin_track_change(enum pcm_track_change_type type,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Everything needed for the codec is ready - start it */
|
/* 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);
|
playing_id3_sync(&info, -1, -1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2924,6 +2926,7 @@ static void audio_stop_playback(void)
|
||||||
|
|
||||||
skip_pending = TRACK_SKIP_NONE;
|
skip_pending = TRACK_SKIP_NONE;
|
||||||
track_event_flags = TEF_NONE;
|
track_event_flags = TEF_NONE;
|
||||||
|
track_skip_is_manual = false;
|
||||||
|
|
||||||
/* Close all tracks and mark them NULL */
|
/* Close all tracks and mark them NULL */
|
||||||
remove_event(BUFFER_EVENT_REBUFFER, buffer_event_rebuffer_callback);
|
remove_event(BUFFER_EVENT_REBUFFER, buffer_event_rebuffer_callback);
|
||||||
|
@ -2999,6 +3002,11 @@ static void audio_on_skip(void)
|
||||||
/* Manual skip */
|
/* Manual skip */
|
||||||
track_event_flags = TEF_NONE;
|
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
|
/* If there was an auto skip in progress, there will be residual
|
||||||
advancement of the playlist and/or track list so compensation will be
|
advancement of the playlist and/or track list so compensation will be
|
||||||
required in order to end up in the right spot */
|
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_list_delta += d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
track_skip_is_manual = false;
|
||||||
/* Adjust things by how much the playlist was manually moved */
|
/* Adjust things by how much the playlist was manually moved */
|
||||||
playlist_peek_offset -= playlist_delta;
|
playlist_peek_offset -= playlist_delta;
|
||||||
|
|
||||||
|
@ -3750,10 +3758,11 @@ void audio_resume(void)
|
||||||
audio_queue_send(Q_AUDIO_PAUSE, false);
|
audio_queue_send(Q_AUDIO_PAUSE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Internal function used by REPEAT_ONE */
|
/* Internal function used by REPEAT_ONE extern playlist.c */
|
||||||
bool audio_pending_track_skip_is_auto(void)
|
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 */
|
/* Skip the specified number of tracks forward or backward from the current */
|
||||||
|
|
|
@ -168,10 +168,10 @@
|
||||||
|
|
||||||
static struct playlist_info current_playlist;
|
static struct playlist_info current_playlist;
|
||||||
/* REPEAT_ONE support function from playback.c */
|
/* 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)
|
static inline bool is_manual_skip(void)
|
||||||
{
|
{
|
||||||
return !audio_pending_track_skip_is_auto();
|
return audio_pending_track_skip_is_manual();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Directory Cache*/
|
/* Directory Cache*/
|
||||||
|
@ -1698,8 +1698,7 @@ static int get_next_index(const struct playlist_info* playlist, int steps,
|
||||||
if (repeat_mode == -1)
|
if (repeat_mode == -1)
|
||||||
repeat_mode = global_settings.repeat_mode;
|
repeat_mode = global_settings.repeat_mode;
|
||||||
|
|
||||||
if ((repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1) ||
|
if (repeat_mode == REPEAT_SHUFFLE && playlist->amount <= 1)
|
||||||
(repeat_mode == REPEAT_ONE && is_manual_skip()))
|
|
||||||
{
|
{
|
||||||
repeat_mode = REPEAT_ALL;
|
repeat_mode = REPEAT_ALL;
|
||||||
}
|
}
|
||||||
|
@ -2833,25 +2832,25 @@ int playlist_next(int steps)
|
||||||
playlist_write_lock(playlist);
|
playlist_write_lock(playlist);
|
||||||
|
|
||||||
int index;
|
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 (steps > 0)
|
||||||
{
|
{
|
||||||
if (repeat == REPEAT_ONE && is_manual_skip())
|
|
||||||
{
|
|
||||||
repeat = REPEAT_ALL;
|
|
||||||
}
|
|
||||||
#ifdef AB_REPEAT_ENABLE
|
#ifdef AB_REPEAT_ENABLE
|
||||||
else if (repeat != REPEAT_ONE && repeat != REPEAT_AB)
|
if (repeat_mode != REPEAT_AB && repeat_mode != REPEAT_ONE)
|
||||||
#else
|
#else
|
||||||
else if (repeat != REPEAT_ONE)
|
if (repeat_mode != REPEAT_ONE)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
/* We need to delete all the queued songs */
|
/* We need to delete all the queued songs */
|
||||||
for (i=0, j=steps; i<j; i++)
|
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)
|
if (index >= 0 && playlist->indices[index] & PLAYLIST_QUEUE_MASK)
|
||||||
{
|
{
|
||||||
|
@ -2861,12 +2860,12 @@ int playlist_next(int steps)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /*steps > 0*/
|
} /*steps > 0*/
|
||||||
index = get_next_index(playlist, steps, repeat);
|
index = get_next_index(playlist, steps, repeat_mode);
|
||||||
|
|
||||||
if (index < 0)
|
if (index < 0)
|
||||||
{
|
{
|
||||||
/* end of playlist... or is it */
|
/* 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 */
|
/* Repeat shuffle mode. Re-shuffle playlist and resume play */
|
||||||
playlist->first_index = 0;
|
playlist->first_index = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue