diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-06-17 10:36:42 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-06-17 10:36:42 +0000 |
commit | fc2bb6cd2086045d8261b0bf95703510a3aa1bc6 (patch) | |
tree | 9311df0d3118b4985aa6473770a4cd873b5d5fe6 /apps | |
parent | dbf59f490e716a7cc92cbb999572c08236e4908d (diff) | |
download | rockbox-fc2bb6cd2086045d8261b0bf95703510a3aa1bc6.tar.gz rockbox-fc2bb6cd2086045d8261b0bf95703510a3aa1bc6.zip |
Made playlist shuffle an option instead of an action
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1031 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/main_menu.c | 29 | ||||
-rw-r--r-- | apps/playlist.c | 9 | ||||
-rw-r--r-- | apps/playlist.h | 3 |
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 | ||
170 | void shuffle(void) | 170 | void 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 | ||
186 | void main_menu(void) | 197 | void 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 | ||
33 | playlist_info_t playlist; | 33 | playlist_info_t playlist; |
34 | bool playlist_shuffle = false; | ||
34 | 35 | ||
35 | char now_playing[256]; | 36 | char 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 | ||
35 | extern playlist_info_t playlist; | 37 | extern playlist_info_t playlist; |
38 | extern bool playlist_shuffle; | ||
36 | 39 | ||
37 | void play_list(char *dir, char *file); | 40 | void play_list(char *dir, char *file); |
38 | char* playlist_next(int type); | 41 | char* playlist_next(int type); |