mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-11 16:37:45 -04:00
playback: fix single mode handling with auto frequency switch enabled
Fix single mode fails to pause between tracks with different sample rates with auto frequency switch enabled.
Fixup for c199d9a3
Change-Id: I51bbd33a15be16b711b3a8e46c0cab1b15a93705
This commit is contained in:
parent
5cf3c6bf9a
commit
3373ed6744
1 changed files with 22 additions and 17 deletions
|
|
@ -2734,6 +2734,16 @@ static void audio_finalise_track_change(void)
|
|||
{
|
||||
buf_read_cuesheet(info.cuesheet_hid);
|
||||
track_id3 = bufgetid3(info.id3_hid);
|
||||
|
||||
/* When pause_on_track_change is calculated, next track_info may be missing
|
||||
* (due to a low buffer or an automatic directory change),
|
||||
* so we need to recalculate it. */
|
||||
if (pause_on_track_change || single_mode_do_pause(info.id3_hid))
|
||||
{
|
||||
play_status = PLAY_PAUSED;
|
||||
pcmbuf_pause(true);
|
||||
pause_on_track_change = false;
|
||||
}
|
||||
}
|
||||
/* Sync the next track information */
|
||||
have_info = track_list_current(1, &info);
|
||||
|
|
@ -2810,11 +2820,16 @@ static void audio_monitor_end_of_playlist(void)
|
|||
}
|
||||
|
||||
/* Does this track have an entry allocated? */
|
||||
static bool audio_can_change_track(int *trackstat, int *id3_hid)
|
||||
static bool audio_can_change_track(int *trackstat, enum pcm_track_change_type *type)
|
||||
{
|
||||
struct track_info info;
|
||||
bool have_track = track_list_advance_current(1, &info);
|
||||
*id3_hid = info.id3_hid;
|
||||
|
||||
pause_on_track_change = have_track && single_mode_do_pause(info.id3_hid);
|
||||
*type = pause_on_track_change
|
||||
? TRACK_CHANGE_END_OF_DATA
|
||||
: TRACK_CHANGE_AUTO;
|
||||
|
||||
if (!have_track || info.audio_hid < 0)
|
||||
{
|
||||
bool end_of_playlist = false;
|
||||
|
|
@ -2823,8 +2838,8 @@ static bool audio_can_change_track(int *trackstat, int *id3_hid)
|
|||
{
|
||||
if (filling == STATE_STOPPED)
|
||||
{
|
||||
audio_begin_track_change(TRACK_CHANGE_END_OF_DATA, *trackstat);
|
||||
return false;
|
||||
*type = TRACK_CHANGE_END_OF_DATA;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Track load is not complete - it might have stopped on a
|
||||
|
|
@ -2926,14 +2941,10 @@ static void audio_on_codec_complete(int status)
|
|||
track_event_flags = TEF_AUTO_SKIP;
|
||||
skip_pending = TRACK_SKIP_AUTO;
|
||||
|
||||
int id3_hid = 0;
|
||||
if (audio_can_change_track(&trackstat, &id3_hid))
|
||||
enum pcm_track_change_type type;
|
||||
if (audio_can_change_track(&trackstat, &type))
|
||||
{
|
||||
pause_on_track_change = single_mode_do_pause(id3_hid);
|
||||
audio_begin_track_change(
|
||||
pause_on_track_change
|
||||
? TRACK_CHANGE_END_OF_DATA
|
||||
: TRACK_CHANGE_AUTO, trackstat);
|
||||
audio_begin_track_change(type, trackstat);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2950,12 +2961,6 @@ static void audio_on_codec_seek_complete(void)
|
|||
(Q_AUDIO_TRACK_CHANGED) */
|
||||
static void audio_on_track_changed(void)
|
||||
{
|
||||
if (pause_on_track_change)
|
||||
{
|
||||
play_status = PLAY_PAUSED;
|
||||
pause_on_track_change = false;
|
||||
}
|
||||
|
||||
/* Finish whatever is pending so that the WPS is in sync */
|
||||
audio_finalise_track_change();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue