diff options
-rw-r--r-- | apps/playlist.c | 8 | ||||
-rw-r--r-- | apps/playlist.h | 2 | ||||
-rw-r--r-- | apps/tree.c | 49 | ||||
-rw-r--r-- | apps/wps.c | 24 | ||||
-rw-r--r-- | firmware/mpeg.c | 6 |
5 files changed, 54 insertions, 35 deletions
diff --git a/apps/playlist.c b/apps/playlist.c index 5d7ef2fd6c..bd5c2b2053 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -35,15 +35,15 @@ bool playlist_shuffle = false; | |||
35 | 35 | ||
36 | char now_playing[256]; | 36 | char now_playing[256]; |
37 | 37 | ||
38 | char* playlist_next(int type) | 38 | char* playlist_next(int steps) |
39 | { | 39 | { |
40 | int seek = playlist.indices[playlist.index]; | 40 | int seek; |
41 | int max; | 41 | int max; |
42 | int fd; | 42 | int fd; |
43 | int i; | 43 | int i; |
44 | (void)type; /* prevent compiler warning until this is gets used */ | ||
45 | 44 | ||
46 | playlist.index = (playlist.index+1) % playlist.amount; | 45 | playlist.index = (playlist.index+steps) % playlist.amount; |
46 | seek = playlist.indices[playlist.index]; | ||
47 | 47 | ||
48 | fd = open(playlist.filename, O_RDONLY); | 48 | fd = open(playlist.filename, O_RDONLY); |
49 | if(-1 != fd) { | 49 | if(-1 != fd) { |
diff --git a/apps/playlist.h b/apps/playlist.h index 2517d2b877..273a612da0 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -38,7 +38,7 @@ extern playlist_info_t playlist; | |||
38 | extern bool playlist_shuffle; | 38 | extern bool playlist_shuffle; |
39 | 39 | ||
40 | void play_list(char *dir, char *file); | 40 | void play_list(char *dir, char *file); |
41 | char* playlist_next(int type); | 41 | char* playlist_next(int steps); |
42 | void randomise_playlist( playlist_info_t *playlist, unsigned int seed ); | 42 | void randomise_playlist( playlist_info_t *playlist, unsigned int seed ); |
43 | void empty_playlist( playlist_info_t *playlist ); | 43 | void empty_playlist( playlist_info_t *playlist ); |
44 | void add_indices_to_playlist( playlist_info_t *playlist ); | 44 | void add_indices_to_playlist( playlist_info_t *playlist ); |
diff --git a/apps/tree.c b/apps/tree.c index a071ce73d6..4b16bac68b 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -190,7 +190,7 @@ static int playing = 0; | |||
190 | static char currdir[255]; | 190 | static char currdir[255]; |
191 | 191 | ||
192 | /* QUICK HACK! this should be handled by the playlist code later */ | 192 | /* QUICK HACK! this should be handled by the playlist code later */ |
193 | char* peek_next_track(int type) | 193 | char* peek_next_track(int steps) |
194 | { | 194 | { |
195 | static char buf[256]; | 195 | static char buf[256]; |
196 | 196 | ||
@@ -204,26 +204,39 @@ char* peek_next_track(int type) | |||
204 | /* play-full-dir mode */ | 204 | /* play-full-dir mode */ |
205 | 205 | ||
206 | /* get next track in dir */ | 206 | /* get next track in dir */ |
207 | while (dircursor + start + 1 < numentries ) { | 207 | if ( steps == 1 ) { |
208 | if(dircursor+1 < TREE_MAX_ON_SCREEN) | 208 | while (dircursor + start + 1 < numentries ) { |
209 | dircursor++; | 209 | if(dircursor+1 < TREE_MAX_ON_SCREEN) |
210 | else | 210 | dircursor++; |
211 | start++; | 211 | else |
212 | if ( dircacheptr[dircursor+start]->file && | 212 | start++; |
213 | dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') { | 213 | if ( dircacheptr[dircursor+start]->file && |
214 | snprintf(buf,sizeof buf,"%s/%s", | 214 | dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') { |
215 | currdir, dircacheptr[dircursor+start]->name ); | 215 | snprintf(buf,sizeof buf,"%s/%s", |
216 | lcd_clear_display(); | 216 | currdir, dircacheptr[dircursor+start]->name ); |
217 | lcd_puts(0,0,"<Playing>"); | 217 | return buf; |
218 | lcd_puts(0,1,"<all files>"); | 218 | } |
219 | return buf; | 219 | } |
220 | } | ||
221 | else { | ||
222 | while (dircursor + start > 0) { | ||
223 | if (dircursor > 0) | ||
224 | dircursor--; | ||
225 | else | ||
226 | start--; | ||
227 | if ( dircacheptr[dircursor+start]->file && | ||
228 | dircacheptr[dircursor+start]->name[strlen(dircacheptr[dircursor+start]->name)-1] == '3') { | ||
229 | snprintf(buf, sizeof(buf), "%s/%s", | ||
230 | currdir, dircacheptr[dircursor+start]->name); | ||
231 | return buf; | ||
232 | } | ||
220 | } | 233 | } |
221 | } | 234 | } |
222 | break; | 235 | break; |
223 | 236 | ||
224 | case 2: | 237 | case 2: |
225 | /* playlist mode */ | 238 | /* playlist mode */ |
226 | return playlist_next(type); | 239 | return playlist_next(steps); |
227 | } | 240 | } |
228 | 241 | ||
229 | return NULL; | 242 | return NULL; |
@@ -313,8 +326,9 @@ bool dirbrowse(char *root) | |||
313 | else { | 326 | else { |
314 | 327 | ||
315 | playing = 1; | 328 | playing = 1; |
316 | playtune(buf); | 329 | mpeg_play(buf); |
317 | playing = 0; | 330 | lcd_stop_scroll(); |
331 | wps_show(); | ||
318 | } | 332 | } |
319 | } | 333 | } |
320 | restore = true; | 334 | restore = true; |
@@ -367,7 +381,6 @@ bool dirbrowse(char *root) | |||
367 | 381 | ||
368 | if ( restore ) { | 382 | if ( restore ) { |
369 | /* restore display */ | 383 | /* restore display */ |
370 | /* TODO: this is just a copy from BUTTON_STOP, fix it */ | ||
371 | numentries = showdir(currdir, start); | 384 | numentries = showdir(currdir, start); |
372 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); | 385 | put_cursorxy(0, CURSOR_Y + LINE_Y+dircursor, true); |
373 | } | 386 | } |
diff --git a/apps/wps.c b/apps/wps.c index 75b68d0d8d..838f8f786a 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -146,25 +146,35 @@ void wps_show(void) | |||
146 | 146 | ||
147 | #ifdef HAVE_RECORDER_KEYPAD | 147 | #ifdef HAVE_RECORDER_KEYPAD |
148 | case BUTTON_UP: | 148 | case BUTTON_UP: |
149 | #else | ||
150 | case BUTTON_RIGHT: | ||
151 | #endif | ||
152 | global_settings.volume += 2; | 149 | global_settings.volume += 2; |
153 | if(global_settings.volume > 100) | 150 | if(global_settings.volume > 100) |
154 | global_settings.volume = 100; | 151 | global_settings.volume = 100; |
155 | mpeg_volume(global_settings.volume); | 152 | mpeg_volume(global_settings.volume); |
156 | break; | 153 | break; |
157 | 154 | ||
158 | #ifdef HAVE_RECORDER_KEYPAD | ||
159 | case BUTTON_DOWN: | 155 | case BUTTON_DOWN: |
160 | #else | ||
161 | case BUTTON_LEFT: | ||
162 | #endif | ||
163 | global_settings.volume -= 2; | 156 | global_settings.volume -= 2; |
164 | if(global_settings.volume < 0) | 157 | if(global_settings.volume < 0) |
165 | global_settings.volume = 0; | 158 | global_settings.volume = 0; |
166 | mpeg_volume(global_settings.volume); | 159 | mpeg_volume(global_settings.volume); |
167 | break; | 160 | break; |
161 | #endif | ||
162 | |||
163 | case BUTTON_LEFT: | ||
164 | mpeg_prev(); | ||
165 | break; | ||
166 | |||
167 | case BUTTON_RIGHT: | ||
168 | mpeg_next(); | ||
169 | break; | ||
170 | |||
171 | #ifdef HAVE_RECORDER_KEYPAD | ||
172 | case BUTTON_OFF: | ||
173 | #else | ||
174 | case BUTTON_DOWN: | ||
175 | #endif | ||
176 | mpeg_stop(); | ||
177 | break; | ||
168 | } | 178 | } |
169 | sleep(HZ/20); | 179 | sleep(HZ/20); |
170 | } | 180 | } |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index b1cbf33e7e..31e50caed3 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -319,11 +319,7 @@ static int new_file(bool next_track) | |||
319 | { | 319 | { |
320 | char *trackname; | 320 | char *trackname; |
321 | 321 | ||
322 | if (next_track) | 322 | trackname = peek_next_track( next_track ? 1 : -1 ); |
323 | trackname = peek_next_track(0); | ||
324 | else | ||
325 | trackname = peek_prev_track(0); | ||
326 | |||
327 | if ( !trackname ) | 323 | if ( !trackname ) |
328 | return -1; | 324 | return -1; |
329 | 325 | ||