diff options
-rw-r--r-- | apps/playback.c | 10 | ||||
-rw-r--r-- | apps/playback.h | 3 | ||||
-rw-r--r-- | apps/playlist.c | 53 | ||||
-rw-r--r-- | apps/wps.c | 36 | ||||
-rw-r--r-- | apps/wps.h | 2 |
5 files changed, 74 insertions, 30 deletions
diff --git a/apps/playback.c b/apps/playback.c index 8f300f5145..01c1dd6a94 100644 --- a/apps/playback.c +++ b/apps/playback.c | |||
@@ -1659,15 +1659,7 @@ static void initiate_dir_change(int direction) | |||
1659 | if(!playlist_next_dir(direction)) | 1659 | if(!playlist_next_dir(direction)) |
1660 | return; | 1660 | return; |
1661 | 1661 | ||
1662 | /* Detect if disk is spinning.. */ | 1662 | queue_post(&audio_queue, AUDIO_PLAY, 0); |
1663 | if (filling) { | ||
1664 | queue_post(&audio_queue, AUDIO_PLAY, 0); | ||
1665 | } else { | ||
1666 | new_track = 0; | ||
1667 | ci.reload_codec = true; | ||
1668 | if (!pcmbuf_is_crossfade_enabled()) | ||
1669 | pcmbuf_flush_audio(); | ||
1670 | } | ||
1671 | 1663 | ||
1672 | codec_track_changed(); | 1664 | codec_track_changed(); |
1673 | } | 1665 | } |
diff --git a/apps/playback.h b/apps/playback.h index 0fb5d5c319..8128cc2490 100644 --- a/apps/playback.h +++ b/apps/playback.h | |||
@@ -55,6 +55,9 @@ void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3, | |||
55 | void audio_invalidate_tracks(void); | 55 | void audio_invalidate_tracks(void); |
56 | void voice_init(void); | 56 | void voice_init(void); |
57 | 57 | ||
58 | extern void audio_next_dir(void); | ||
59 | extern void audio_prev_dir(void); | ||
60 | |||
58 | #endif | 61 | #endif |
59 | 62 | ||
60 | 63 | ||
diff --git a/apps/playlist.c b/apps/playlist.c index 8bf1fd2116..c43174b0b6 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -130,6 +130,8 @@ | |||
130 | 130 | ||
131 | #define PLAYLIST_DISPLAY_COUNT 10 | 131 | #define PLAYLIST_DISPLAY_COUNT 10 |
132 | 132 | ||
133 | static bool changing_dir = false; | ||
134 | |||
133 | static struct playlist_info current_playlist; | 135 | static struct playlist_info current_playlist; |
134 | static char now_playing[MAX_PATH+1]; | 136 | static char now_playing[MAX_PATH+1]; |
135 | 137 | ||
@@ -2072,6 +2074,7 @@ int playlist_next(int steps) | |||
2072 | { | 2074 | { |
2073 | char dir[MAX_PATH+1]; | 2075 | char dir[MAX_PATH+1]; |
2074 | 2076 | ||
2077 | changing_dir = true; | ||
2075 | if (steps > 0) | 2078 | if (steps > 0) |
2076 | { | 2079 | { |
2077 | if (!get_next_directory(dir)) | 2080 | if (!get_next_directory(dir)) |
@@ -2089,19 +2092,20 @@ int playlist_next(int steps) | |||
2089 | } | 2092 | } |
2090 | else | 2093 | else |
2091 | { | 2094 | { |
2092 | if (!get_previous_directory(dir)) | 2095 | if (!get_previous_directory(dir)) |
2093 | { | ||
2094 | /* start playing previous directory */ | ||
2095 | if (playlist_create(dir, NULL) != -1) | ||
2096 | { | 2096 | { |
2097 | ft_build_playlist(tree_get_context(), 0); | 2097 | /* start playing previous directory */ |
2098 | if (global_settings.playlist_shuffle) | 2098 | if (playlist_create(dir, NULL) != -1) |
2099 | playlist_shuffle(current_tick, -1); | 2099 | { |
2100 | playlist_start(current_playlist.amount-1,0); | 2100 | ft_build_playlist(tree_get_context(), 0); |
2101 | index = current_playlist.amount-1; | 2101 | if (global_settings.playlist_shuffle) |
2102 | playlist_shuffle(current_tick, -1); | ||
2103 | playlist_start(current_playlist.amount-1,0); | ||
2104 | index = current_playlist.amount-1; | ||
2105 | } | ||
2102 | } | 2106 | } |
2103 | } | 2107 | } |
2104 | } | 2108 | changing_dir = true; |
2105 | } | 2109 | } |
2106 | 2110 | ||
2107 | return index; | 2111 | return index; |
@@ -2154,9 +2158,22 @@ int playlist_next(int steps) | |||
2154 | bool playlist_next_dir(int direction) | 2158 | bool playlist_next_dir(int direction) |
2155 | { | 2159 | { |
2156 | char dir[MAX_PATH+1]; | 2160 | char dir[MAX_PATH+1]; |
2161 | bool result; | ||
2162 | int res; | ||
2163 | |||
2164 | /* not to mess up real playlists */ | ||
2165 | if(!current_playlist.in_ram) | ||
2166 | return false; | ||
2167 | |||
2168 | if(changing_dir) | ||
2169 | return false; | ||
2157 | 2170 | ||
2158 | if (((direction > 0) && !get_next_directory(dir)) || | 2171 | changing_dir = true; |
2159 | ((direction < 0) && !get_previous_directory(dir))) | 2172 | if(direction > 0) |
2173 | res = get_next_directory(dir); | ||
2174 | else | ||
2175 | res = get_previous_directory(dir); | ||
2176 | if (!res) | ||
2160 | { | 2177 | { |
2161 | if (playlist_create(dir, NULL) != -1) | 2178 | if (playlist_create(dir, NULL) != -1) |
2162 | { | 2179 | { |
@@ -2164,13 +2181,17 @@ bool playlist_next_dir(int direction) | |||
2164 | if (global_settings.playlist_shuffle) | 2181 | if (global_settings.playlist_shuffle) |
2165 | playlist_shuffle(current_tick, -1); | 2182 | playlist_shuffle(current_tick, -1); |
2166 | playlist_start(0,0); | 2183 | playlist_start(0,0); |
2167 | return true; | 2184 | result = true; |
2168 | } | 2185 | } |
2169 | else | 2186 | else |
2170 | return false; | 2187 | result = false; |
2171 | } | 2188 | } |
2172 | else | 2189 | else |
2173 | return false; | 2190 | result = false; |
2191 | |||
2192 | changing_dir = false; | ||
2193 | |||
2194 | return result; | ||
2174 | } | 2195 | } |
2175 | 2196 | ||
2176 | /* Get resume info for current playing song. If return value is -1 then | 2197 | /* Get resume info for current playing song. If return value is -1 then |
diff --git a/apps/wps.c b/apps/wps.c index 7a9a5de60b..31fcd2cb6d 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include "sound.h" | 52 | #include "sound.h" |
53 | #include "onplay.h" | 53 | #include "onplay.h" |
54 | #include "abrepeat.h" | 54 | #include "abrepeat.h" |
55 | #include "playback.h" | ||
55 | 56 | ||
56 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ | 57 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ |
57 | /* 3% of 30min file == 54s step size */ | 58 | /* 3% of 30min file == 54s step size */ |
@@ -64,9 +65,6 @@ static struct mp3entry* id3 = NULL; | |||
64 | static struct mp3entry* nid3 = NULL; | 65 | static struct mp3entry* nid3 = NULL; |
65 | static char current_track_path[MAX_PATH+1]; | 66 | static char current_track_path[MAX_PATH+1]; |
66 | 67 | ||
67 | void audio_next_dir(void); | ||
68 | void audio_prev_dir(void); | ||
69 | |||
70 | /* set volume | 68 | /* set volume |
71 | return true if screen restore is needed | 69 | return true if screen restore is needed |
72 | return false otherwise | 70 | return false otherwise |
@@ -337,6 +335,8 @@ long wps_show(void) | |||
337 | long restoretimer = 0; /* timer to delay screen redraw temporarily */ | 335 | long restoretimer = 0; /* timer to delay screen redraw temporarily */ |
338 | bool exit = false; | 336 | bool exit = false; |
339 | bool update_track = false; | 337 | bool update_track = false; |
338 | unsigned long right_lastclick = 0; | ||
339 | unsigned long left_lastclick = 0; | ||
340 | 340 | ||
341 | id3 = nid3 = NULL; | 341 | id3 = nid3 = NULL; |
342 | current_track_path[0] = '\0'; | 342 | current_track_path[0] = '\0'; |
@@ -555,12 +555,30 @@ long wps_show(void) | |||
555 | break; | 555 | break; |
556 | 556 | ||
557 | /* fast forward / rewind */ | 557 | /* fast forward / rewind */ |
558 | case WPS_FFWD: | ||
559 | case WPS_REW: | ||
560 | #ifdef WPS_RC_FFWD | 558 | #ifdef WPS_RC_FFWD |
561 | case WPS_RC_FFWD: | 559 | case WPS_RC_FFWD: |
560 | #endif | ||
561 | case WPS_FFWD: | ||
562 | #ifdef WPS_NEXT_DIR | ||
563 | if (current_tick - right_lastclick < HZ) | ||
564 | { | ||
565 | audio_next_dir(); | ||
566 | right_lastclick = 0; | ||
567 | break; | ||
568 | } | ||
569 | #endif | ||
570 | #ifdef WPS_RC_REW | ||
562 | case WPS_RC_REW: | 571 | case WPS_RC_REW: |
563 | #endif | 572 | #endif |
573 | case WPS_REW: | ||
574 | #ifdef WPS_PREV_DIR | ||
575 | if (current_tick - left_lastclick < HZ) | ||
576 | { | ||
577 | audio_prev_dir(); | ||
578 | left_lastclick = 0; | ||
579 | break; | ||
580 | } | ||
581 | #endif | ||
564 | ffwd_rew(button); | 582 | ffwd_rew(button); |
565 | break; | 583 | break; |
566 | 584 | ||
@@ -577,6 +595,7 @@ long wps_show(void) | |||
577 | break; | 595 | break; |
578 | #endif | 596 | #endif |
579 | #endif | 597 | #endif |
598 | left_lastclick = current_tick; | ||
580 | 599 | ||
581 | #ifdef AB_REPEAT_ENABLE | 600 | #ifdef AB_REPEAT_ENABLE |
582 | /* if we're in A/B repeat mode and the current position | 601 | /* if we're in A/B repeat mode and the current position |
@@ -604,13 +623,19 @@ long wps_show(void) | |||
604 | } | 623 | } |
605 | break; | 624 | break; |
606 | 625 | ||
626 | #ifdef WPS_NEXT_DIR | ||
607 | #ifdef WPS_RC_NEXT_DIR | 627 | #ifdef WPS_RC_NEXT_DIR |
608 | case WPS_RC_NEXT_DIR: | 628 | case WPS_RC_NEXT_DIR: |
629 | #endif | ||
630 | case WPS_NEXT_DIR: | ||
609 | audio_next_dir(); | 631 | audio_next_dir(); |
610 | break; | 632 | break; |
611 | #endif | 633 | #endif |
634 | #ifdef WPS_PREV_DIR | ||
612 | #ifdef WPS_RC_PREV_DIR | 635 | #ifdef WPS_RC_PREV_DIR |
613 | case WPS_RC_PREV_DIR: | 636 | case WPS_RC_PREV_DIR: |
637 | #endif | ||
638 | case WPS_PREV_DIR: | ||
614 | audio_prev_dir(); | 639 | audio_prev_dir(); |
615 | break; | 640 | break; |
616 | #endif | 641 | #endif |
@@ -628,6 +653,7 @@ long wps_show(void) | |||
628 | break; | 653 | break; |
629 | #endif | 654 | #endif |
630 | #endif | 655 | #endif |
656 | right_lastclick = current_tick; | ||
631 | 657 | ||
632 | #ifdef AB_REPEAT_ENABLE | 658 | #ifdef AB_REPEAT_ENABLE |
633 | /* if we're in A/B repeat mode and the current position is | 659 | /* if we're in A/B repeat mode and the current position is |
diff --git a/apps/wps.h b/apps/wps.h index b8499984a8..a419c809f0 100644 --- a/apps/wps.h +++ b/apps/wps.h | |||
@@ -43,6 +43,8 @@ | |||
43 | #define WPS_ID3 (BUTTON_MODE | BUTTON_ON) | 43 | #define WPS_ID3 (BUTTON_MODE | BUTTON_ON) |
44 | #define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) | 44 | #define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT) |
45 | #define WPS_QUICK (BUTTON_MODE | BUTTON_REPEAT) | 45 | #define WPS_QUICK (BUTTON_MODE | BUTTON_REPEAT) |
46 | #define WPS_NEXT_DIR (BUTTON_RIGHT | BUTTON_ON) | ||
47 | #define WPS_PREV_DIR (BUTTON_LEFT | BUTTON_ON) | ||
46 | 48 | ||
47 | #define WPS_RC_NEXT_DIR (BUTTON_RC_BITRATE | BUTTON_REL) | 49 | #define WPS_RC_NEXT_DIR (BUTTON_RC_BITRATE | BUTTON_REL) |
48 | #define WPS_RC_PREV_DIR (BUTTON_RC_SOURCE | BUTTON_REL) | 50 | #define WPS_RC_PREV_DIR (BUTTON_RC_SOURCE | BUTTON_REL) |