From 2b18727a8abe08cf5f9d267d5f664bff13bd1cb2 Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Tue, 18 Apr 2006 18:33:09 +0000 Subject: Fix dir skipping with new playback arch. Enable dir skipping on ipod with a couple of difficult combos (select|right/left) or short-long left / short-long right. The latter causes stuck in pause sometimes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9720 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps.h | 3 +++ apps/playback.c | 40 ++++++++++++++++++++++++++++++++-------- apps/playlist.c | 2 ++ 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/apps/gui/gwps.h b/apps/gui/gwps.h index d9f7224681..0c170f1a7e 100644 --- a/apps/gui/gwps.h +++ b/apps/gui/gwps.h @@ -198,6 +198,9 @@ #define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) #define WPS_QUICK (BUTTON_MENU | BUTTON_REPEAT) +#define WPS_NEXT_DIR (BUTTON_SELECT | BUTTON_RIGHT) +#define WPS_PREV_DIR (BUTTON_SELECT | BUTTON_LEFT) + #ifdef AB_REPEAT_ENABLE #define WPS_AB_SET_A_MARKER (BUTTON_MENU | BUTTON_LEFT) #define WPS_AB_SET_B_MARKER (BUTTON_MENU | BUTTON_RIGHT) diff --git a/apps/playback.c b/apps/playback.c index babb0f1006..ec9ad41a96 100644 --- a/apps/playback.c +++ b/apps/playback.c @@ -225,7 +225,8 @@ extern struct codec_api ci; extern struct codec_api ci_voice; /* Was the skip being executed manual or automatic? */ -static volatile bool manual_skip; +static bool manual_skip; +static bool dir_skip = false; /* Callback function to call when current track has really changed. */ void (*track_changed_callback)(struct mp3entry *id3); @@ -784,6 +785,23 @@ static void audio_check_new_track(void) int old_track_ridx = track_ridx; bool forward; + if (dir_skip) + { + dir_skip = false; + if (playlist_next_dir(ci.new_track)) + { + ci.new_track = 0; + cur_ti->taginfo_ready = false; + audio_rebuffer(); + goto skip_done; + } + else + { + queue_post(&codec_callback_queue, Q_CODEC_REQUEST_FAILED, 0); + return; + } + } + /* If the playlist isn't that big */ if (!playlist_check(ci.new_track)) { @@ -825,12 +843,18 @@ static void audio_check_new_track(void) { cur_ti->taginfo_ready = false; audio_rebuffer(); + goto skip_done; } + /* If the target track is clearly not in memory */ - else if (cur_ti->filesize == 0 || !cur_ti->taginfo_ready) + if (cur_ti->filesize == 0 || !cur_ti->taginfo_ready) + { audio_rebuffer(); + goto skip_done; + } + /* The track may be in memory, see if it really is */ - else if (forward) + if (forward) { if (!buffer_wind_forward(track_ridx, old_track_ridx)) audio_rebuffer(); @@ -869,6 +893,7 @@ static void audio_check_new_track(void) } } +skip_done: audio_update_trackinfo(); queue_post(&codec_callback_queue, Q_CODEC_REQUEST_COMPLETE, 0); } @@ -1678,7 +1703,7 @@ static void audio_play_start(size_t offset) radio_stop(); #endif - /* Wait for any previously playing audio to flush */ + /* Wait for any previously playing audio to flush - TODO: Not necessary? */ while (audio_codec_loaded) stop_codec_flush(); @@ -1927,10 +1952,9 @@ static void initiate_track_change(long direction) static void initiate_dir_change(long direction) { - if(!playlist_next_dir(direction)) - return; - - queue_post(&audio_queue, Q_AUDIO_PLAY, 0); + playlist_end = false; + dir_skip = true; + ci.new_track = direction; } void audio_thread(void) diff --git a/apps/playlist.c b/apps/playlist.c index f3339a6862..f11cb04370 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -2542,7 +2542,9 @@ bool playlist_next_dir(int direction) ft_build_playlist(tree_get_context(), 0); if (global_settings.playlist_shuffle) playlist_shuffle(current_tick, -1); +#if (CONFIG_CODEC != SWCODEC) playlist_start(0,0); +#endif result = true; } else -- cgit v1.2.3