diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/main_menu.c | 19 | ||||
-rw-r--r-- | apps/playlist.c | 7 | ||||
-rw-r--r-- | apps/playlist.h | 4 |
3 files changed, 25 insertions, 5 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c index e4bccd2720..0b4da978d8 100644 --- a/apps/main_menu.c +++ b/apps/main_menu.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "debug.h" | 29 | #include "debug.h" |
30 | #include "sprintf.h" | 30 | #include "sprintf.h" |
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include "playlist.h" | ||
32 | 33 | ||
33 | #ifdef HAVE_LCD_BITMAP | 34 | #ifdef HAVE_LCD_BITMAP |
34 | #include "bmp.h" | 35 | #include "bmp.h" |
@@ -164,15 +165,31 @@ void scroll_speed(void) | |||
164 | } | 165 | } |
165 | } | 166 | } |
166 | 167 | ||
168 | void shuffle(void) | ||
169 | { | ||
170 | lcd_clear_display(); | ||
171 | lcd_puts(0,0,"Shuffling..."); | ||
172 | lcd_update(); | ||
173 | #ifdef SIMULATOR | ||
174 | randomise_playlist( &playlist, time() ); | ||
175 | #else | ||
176 | randomise_playlist( &playlist, current_tick ); | ||
177 | #endif | ||
178 | lcd_puts(0,1,"Done."); | ||
179 | lcd_update(); | ||
180 | sleep(HZ); | ||
181 | } | ||
182 | |||
167 | void main_menu(void) | 183 | void main_menu(void) |
168 | { | 184 | { |
169 | int m; | 185 | int m; |
170 | enum { | 186 | enum { |
171 | Tetris, Screen_Saver, Version, Sound, Scroll | 187 | Tetris, Screen_Saver, Version, Sound, Scroll, Shuffle |
172 | }; | 188 | }; |
173 | 189 | ||
174 | /* main menu */ | 190 | /* main menu */ |
175 | struct menu_items items[] = { | 191 | struct menu_items items[] = { |
192 | { Shuffle, "Shuffle", shuffle }, | ||
176 | { Sound, "Sound", sound_menu }, | 193 | { Sound, "Sound", sound_menu }, |
177 | #ifdef HAVE_LCD_BITMAP | 194 | #ifdef HAVE_LCD_BITMAP |
178 | { Tetris, "Tetris", tetris }, | 195 | { Tetris, "Tetris", tetris }, |
diff --git a/apps/playlist.c b/apps/playlist.c index 85d72dc57f..339964182b 100644 --- a/apps/playlist.c +++ b/apps/playlist.c | |||
@@ -30,8 +30,6 @@ | |||
30 | 30 | ||
31 | playlist_info_t playlist; | 31 | playlist_info_t playlist; |
32 | 32 | ||
33 | int index_array[1000]; | ||
34 | |||
35 | char now_playing[256]; | 33 | char now_playing[256]; |
36 | 34 | ||
37 | char* playlist_next(int type) | 35 | char* playlist_next(int type) |
@@ -138,9 +136,12 @@ void add_indices_to_playlist( playlist_info_t *playlist ) | |||
138 | else if(store_index) | 136 | else if(store_index) |
139 | { | 137 | { |
140 | /* Store a new entry */ | 138 | /* Store a new entry */ |
141 | DEBUGF("tune %d at position %d\n", playlist->amount, i+count); | ||
142 | playlist->indices[ playlist->amount ] = i+count; | 139 | playlist->indices[ playlist->amount ] = i+count; |
143 | playlist->amount++; | 140 | playlist->amount++; |
141 | if ( playlist->amount >= MAX_PLAYLIST_SIZE ) { | ||
142 | close(fd); | ||
143 | return; | ||
144 | } | ||
144 | 145 | ||
145 | store_index = 0; | 146 | store_index = 0; |
146 | } | 147 | } |
diff --git a/apps/playlist.h b/apps/playlist.h index e02c0c5583..300c7aab65 100644 --- a/apps/playlist.h +++ b/apps/playlist.h | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | /* playlist data */ | 23 | /* playlist data */ |
24 | 24 | ||
25 | #define MAX_PLAYLIST_SIZE 1000 | 25 | #define MAX_PLAYLIST_SIZE 10000 |
26 | typedef struct | 26 | typedef struct |
27 | { | 27 | { |
28 | char filename[256]; /* path name of m3u playlist on disk */ | 28 | char filename[256]; /* path name of m3u playlist on disk */ |
@@ -32,6 +32,8 @@ typedef struct | |||
32 | int amount; /* number of tracks in the index */ | 32 | int amount; /* number of tracks in the index */ |
33 | } playlist_info_t; | 33 | } playlist_info_t; |
34 | 34 | ||
35 | extern playlist_info_t playlist; | ||
36 | |||
35 | void play_list(char *dir, char *file); | 37 | void play_list(char *dir, char *file); |
36 | char* playlist_next(int type); | 38 | char* playlist_next(int type); |
37 | void randomise_playlist( playlist_info_t *playlist, unsigned int seed ); | 39 | void randomise_playlist( playlist_info_t *playlist, unsigned int seed ); |