summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-06-17 10:36:42 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-06-17 10:36:42 +0000
commitfc2bb6cd2086045d8261b0bf95703510a3aa1bc6 (patch)
tree9311df0d3118b4985aa6473770a4cd873b5d5fe6 /apps
parentdbf59f490e716a7cc92cbb999572c08236e4908d (diff)
downloadrockbox-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.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)
void shuffle(void)
{
+ bool done = false;
+
lcd_clear_display();
- if(playlist.amount) {
- lcd_puts(0,0,"Shuffling...");
+ lcd_puts(0,0,"[Shuffle]");
+
+ while ( !done ) {
+ lcd_puts(0,1,playlist_shuffle ? "on " : "off");
lcd_update();
- randomise_playlist( &playlist, current_tick );
- lcd_puts(0,1,"Done.");
- }
- else {
- lcd_puts(0,0,"No playlist");
+
+ switch ( button_get(true) ) {
+#ifdef HAVE_RECORDER_KEYPAD
+ case BUTTON_LEFT:
+#else
+ case BUTTON_STOP:
+#endif
+ done = true;
+ break;
+
+ default:
+ playlist_shuffle = !playlist_shuffle;
+ break;
+ }
}
- lcd_update();
- sleep(HZ);
}
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 @@
#include "kernel.h"
playlist_info_t playlist;
+bool playlist_shuffle = false;
char now_playing[256];
@@ -101,9 +102,13 @@ void play_list(char *dir, char *file)
/* add track indices to playlist data structure */
add_indices_to_playlist(&playlist);
- /* if shuffle is wanted, this is where to do that */
+ if(playlist_shuffle) {
+ lcd_puts(0,0,"Shuffling...");
+ lcd_update();
+ randomise_playlist( &playlist, current_tick );
+ }
- lcd_puts(0,0,"Complete. ");
+ lcd_puts(0,0,"Playing... ");
lcd_update();
/* also make the first song get playing */
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 @@
#ifndef __PLAYLIST_H__
#define __PLAYLIST_H__
+#include <stdbool.h>
+
/* playlist data */
#define MAX_PLAYLIST_SIZE 10000
@@ -33,6 +35,7 @@ typedef struct
} playlist_info_t;
extern playlist_info_t playlist;
+extern bool playlist_shuffle;
void play_list(char *dir, char *file);
char* playlist_next(int type);