summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/main_menu.c29
-rw-r--r--apps/playlist.c9
-rw-r--r--apps/playlist.h3
3 files changed, 30 insertions, 11 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 25ab12e97b..fb286eca98 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -169,18 +169,29 @@ void scroll_speed(void)
169 169
170void shuffle(void) 170void shuffle(void)
171{ 171{
172 bool done = false;
173
172 lcd_clear_display(); 174 lcd_clear_display();
173 if(playlist.amount) { 175 lcd_puts(0,0,"[Shuffle]");
174 lcd_puts(0,0,"Shuffling..."); 176
177 while ( !done ) {
178 lcd_puts(0,1,playlist_shuffle ? "on " : "off");
175 lcd_update(); 179 lcd_update();
176 randomise_playlist( &playlist, current_tick ); 180
177 lcd_puts(0,1,"Done."); 181 switch ( button_get(true) ) {
178 } 182#ifdef HAVE_RECORDER_KEYPAD
179 else { 183 case BUTTON_LEFT:
180 lcd_puts(0,0,"No playlist"); 184#else
185 case BUTTON_STOP:
186#endif
187 done = true;
188 break;
189
190 default:
191 playlist_shuffle = !playlist_shuffle;
192 break;
193 }
181 } 194 }
182 lcd_update();
183 sleep(HZ);
184} 195}
185 196
186void main_menu(void) 197void main_menu(void)
diff --git a/apps/playlist.c b/apps/playlist.c
index 942a5785b1..f1bcfaa6e9 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -31,6 +31,7 @@
31#include "kernel.h" 31#include "kernel.h"
32 32
33playlist_info_t playlist; 33playlist_info_t playlist;
34bool playlist_shuffle = false;
34 35
35char now_playing[256]; 36char now_playing[256];
36 37
@@ -101,9 +102,13 @@ void play_list(char *dir, char *file)
101 /* add track indices to playlist data structure */ 102 /* add track indices to playlist data structure */
102 add_indices_to_playlist(&playlist); 103 add_indices_to_playlist(&playlist);
103 104
104 /* if shuffle is wanted, this is where to do that */ 105 if(playlist_shuffle) {
106 lcd_puts(0,0,"Shuffling...");
107 lcd_update();
108 randomise_playlist( &playlist, current_tick );
109 }
105 110
106 lcd_puts(0,0,"Complete. "); 111 lcd_puts(0,0,"Playing... ");
107 lcd_update(); 112 lcd_update();
108 /* also make the first song get playing */ 113 /* also make the first song get playing */
109 mpeg_play(playlist_next(0)); 114 mpeg_play(playlist_next(0));
diff --git a/apps/playlist.h b/apps/playlist.h
index 300c7aab65..2517d2b877 100644
--- a/apps/playlist.h
+++ b/apps/playlist.h
@@ -20,6 +20,8 @@
20#ifndef __PLAYLIST_H__ 20#ifndef __PLAYLIST_H__
21#define __PLAYLIST_H__ 21#define __PLAYLIST_H__
22 22
23#include <stdbool.h>
24
23/* playlist data */ 25/* playlist data */
24 26
25#define MAX_PLAYLIST_SIZE 10000 27#define MAX_PLAYLIST_SIZE 10000
@@ -33,6 +35,7 @@ typedef struct
33} playlist_info_t; 35} playlist_info_t;
34 36
35extern playlist_info_t playlist; 37extern playlist_info_t playlist;
38extern bool playlist_shuffle;
36 39
37void play_list(char *dir, char *file); 40void play_list(char *dir, char *file);
38char* playlist_next(int type); 41char* playlist_next(int type);