Made playlist shuffle an option instead of an action

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1031 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-06-17 10:36:42 +00:00
parent dbf59f490e
commit fc2bb6cd20
3 changed files with 30 additions and 11 deletions

View file

@ -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.");
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;
}
}
else {
lcd_puts(0,0,"No playlist");
}
lcd_update();
sleep(HZ);
}
void main_menu(void)

View file

@ -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));

View file

@ -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);