diff options
-rw-r--r-- | apps/gui/gwps.h | 3 | ||||
-rw-r--r-- | apps/playback.c | 40 | ||||
-rw-r--r-- | 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 @@ | |||
198 | #define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) | 198 | #define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) |
199 | #define WPS_QUICK (BUTTON_MENU | BUTTON_REPEAT) | 199 | #define WPS_QUICK (BUTTON_MENU | BUTTON_REPEAT) |
200 | 200 | ||
201 | #define WPS_NEXT_DIR (BUTTON_SELECT | BUTTON_RIGHT) | ||
202 | #define WPS_PREV_DIR (BUTTON_SELECT | BUTTON_LEFT) | ||
203 | |||
201 | #ifdef AB_REPEAT_ENABLE | 204 | #ifdef AB_REPEAT_ENABLE |
202 | #define WPS_AB_SET_A_MARKER (BUTTON_MENU | BUTTON_LEFT) | 205 | #define WPS_AB_SET_A_MARKER (BUTTON_MENU | BUTTON_LEFT) |
203 | #define WPS_AB_SET_B_MARKER (BUTTON_MENU | BUTTON_RIGHT) | 206 | #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; | |||
225 | extern struct codec_api ci_voice; | 225 | extern struct codec_api ci_voice; |
226 | 226 | ||
227 | /* Was the skip being executed manual or automatic? */ | 227 | /* Was the skip being executed manual or automatic? */ |
228 | static volatile bool manual_skip; | 228 | static bool manual_skip; |
229 | static bool dir_skip = false; | ||
229 | 230 | ||
230 | /* Callback function to call when current track has really changed. */ | 231 | /* Callback function to call when current track has really changed. */ |
231 | void (*track_changed_callback)(struct mp3entry *id3); | 232 | void (*track_changed_callback)(struct mp3entry *id3); |
@@ -784,6 +785,23 @@ static void audio_check_new_track(void) | |||
784 | int old_track_ridx = track_ridx; | 785 | int old_track_ridx = track_ridx; |
785 | bool forward; | 786 | bool forward; |
786 | 787 | ||
788 | if (dir_skip) | ||
789 | { | ||
790 | dir_skip = false; | ||
791 | if (playlist_next_dir(ci.new_track)) | ||
792 | { | ||
793 | ci.new_track = 0; | ||
794 | cur_ti->taginfo_ready = false; | ||
795 | audio_rebuffer(); | ||
796 | goto skip_done; | ||
797 | } | ||
798 | else | ||
799 | { | ||
800 | queue_post(&codec_callback_queue, Q_CODEC_REQUEST_FAILED, 0); | ||
801 | return; | ||
802 | } | ||
803 | } | ||
804 | |||
787 | /* If the playlist isn't that big */ | 805 | /* If the playlist isn't that big */ |
788 | if (!playlist_check(ci.new_track)) | 806 | if (!playlist_check(ci.new_track)) |
789 | { | 807 | { |
@@ -825,12 +843,18 @@ static void audio_check_new_track(void) | |||
825 | { | 843 | { |
826 | cur_ti->taginfo_ready = false; | 844 | cur_ti->taginfo_ready = false; |
827 | audio_rebuffer(); | 845 | audio_rebuffer(); |
846 | goto skip_done; | ||
828 | } | 847 | } |
848 | |||
829 | /* If the target track is clearly not in memory */ | 849 | /* If the target track is clearly not in memory */ |
830 | else if (cur_ti->filesize == 0 || !cur_ti->taginfo_ready) | 850 | if (cur_ti->filesize == 0 || !cur_ti->taginfo_ready) |
851 | { | ||
831 | audio_rebuffer(); | 852 | audio_rebuffer(); |
853 | goto skip_done; | ||
854 | } | ||
855 | |||
832 | /* The track may be in memory, see if it really is */ | 856 | /* The track may be in memory, see if it really is */ |
833 | else if (forward) | 857 | if (forward) |
834 | { | 858 | { |
835 | if (!buffer_wind_forward(track_ridx, old_track_ridx)) | 859 | if (!buffer_wind_forward(track_ridx, old_track_ridx)) |
836 | audio_rebuffer(); | 860 | audio_rebuffer(); |
@@ -869,6 +893,7 @@ static void audio_check_new_track(void) | |||
869 | } | 893 | } |
870 | } | 894 | } |
871 | 895 | ||
896 | skip_done: | ||
872 | audio_update_trackinfo(); | 897 | audio_update_trackinfo(); |
873 | queue_post(&codec_callback_queue, Q_CODEC_REQUEST_COMPLETE, 0); | 898 | queue_post(&codec_callback_queue, Q_CODEC_REQUEST_COMPLETE, 0); |
874 | } | 899 | } |
@@ -1678,7 +1703,7 @@ static void audio_play_start(size_t offset) | |||
1678 | radio_stop(); | 1703 | radio_stop(); |
1679 | #endif | 1704 | #endif |
1680 | 1705 | ||
1681 | /* Wait for any previously playing audio to flush */ | 1706 | /* Wait for any previously playing audio to flush - TODO: Not necessary? */ |
1682 | while (audio_codec_loaded) | 1707 | while (audio_codec_loaded) |
1683 | stop_codec_flush(); | 1708 | stop_codec_flush(); |
1684 | 1709 | ||
@@ -1927,10 +1952,9 @@ static void initiate_track_change(long direction) | |||
1927 | 1952 | ||
1928 | static void initiate_dir_change(long direction) | 1953 | static void initiate_dir_change(long direction) |
1929 | { | 1954 | { |
1930 | if(!playlist_next_dir(direction)) | 1955 | playlist_end = false; |
1931 | return; | 1956 | dir_skip = true; |
1932 | 1957 | ci.new_track = direction; | |
1933 | queue_post(&audio_queue, Q_AUDIO_PLAY, 0); | ||
1934 | } | 1958 | } |
1935 | 1959 | ||
1936 | void audio_thread(void) | 1960 | 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) | |||
2542 | ft_build_playlist(tree_get_context(), 0); | 2542 | ft_build_playlist(tree_get_context(), 0); |
2543 | if (global_settings.playlist_shuffle) | 2543 | if (global_settings.playlist_shuffle) |
2544 | playlist_shuffle(current_tick, -1); | 2544 | playlist_shuffle(current_tick, -1); |
2545 | #if (CONFIG_CODEC != SWCODEC) | ||
2545 | playlist_start(0,0); | 2546 | playlist_start(0,0); |
2547 | #endif | ||
2546 | result = true; | 2548 | result = true; |
2547 | } | 2549 | } |
2548 | else | 2550 | else |