mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
Added playlist shuffle menu option
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@986 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
16c3c127ba
commit
aa26b5cbe3
3 changed files with 25 additions and 5 deletions
|
|
@ -29,6 +29,7 @@
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "sprintf.h"
|
#include "sprintf.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "playlist.h"
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
#include "bmp.h"
|
#include "bmp.h"
|
||||||
|
|
@ -164,15 +165,31 @@ void scroll_speed(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void shuffle(void)
|
||||||
|
{
|
||||||
|
lcd_clear_display();
|
||||||
|
lcd_puts(0,0,"Shuffling...");
|
||||||
|
lcd_update();
|
||||||
|
#ifdef SIMULATOR
|
||||||
|
randomise_playlist( &playlist, time() );
|
||||||
|
#else
|
||||||
|
randomise_playlist( &playlist, current_tick );
|
||||||
|
#endif
|
||||||
|
lcd_puts(0,1,"Done.");
|
||||||
|
lcd_update();
|
||||||
|
sleep(HZ);
|
||||||
|
}
|
||||||
|
|
||||||
void main_menu(void)
|
void main_menu(void)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
enum {
|
enum {
|
||||||
Tetris, Screen_Saver, Version, Sound, Scroll
|
Tetris, Screen_Saver, Version, Sound, Scroll, Shuffle
|
||||||
};
|
};
|
||||||
|
|
||||||
/* main menu */
|
/* main menu */
|
||||||
struct menu_items items[] = {
|
struct menu_items items[] = {
|
||||||
|
{ Shuffle, "Shuffle", shuffle },
|
||||||
{ Sound, "Sound", sound_menu },
|
{ Sound, "Sound", sound_menu },
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
{ Tetris, "Tetris", tetris },
|
{ Tetris, "Tetris", tetris },
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,6 @@
|
||||||
|
|
||||||
playlist_info_t playlist;
|
playlist_info_t playlist;
|
||||||
|
|
||||||
int index_array[1000];
|
|
||||||
|
|
||||||
char now_playing[256];
|
char now_playing[256];
|
||||||
|
|
||||||
char* playlist_next(int type)
|
char* playlist_next(int type)
|
||||||
|
|
@ -138,9 +136,12 @@ void add_indices_to_playlist( playlist_info_t *playlist )
|
||||||
else if(store_index)
|
else if(store_index)
|
||||||
{
|
{
|
||||||
/* Store a new entry */
|
/* Store a new entry */
|
||||||
DEBUGF("tune %d at position %d\n", playlist->amount, i+count);
|
|
||||||
playlist->indices[ playlist->amount ] = i+count;
|
playlist->indices[ playlist->amount ] = i+count;
|
||||||
playlist->amount++;
|
playlist->amount++;
|
||||||
|
if ( playlist->amount >= MAX_PLAYLIST_SIZE ) {
|
||||||
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
store_index = 0;
|
store_index = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
/* playlist data */
|
/* playlist data */
|
||||||
|
|
||||||
#define MAX_PLAYLIST_SIZE 1000
|
#define MAX_PLAYLIST_SIZE 10000
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char filename[256]; /* path name of m3u playlist on disk */
|
char filename[256]; /* path name of m3u playlist on disk */
|
||||||
|
|
@ -32,6 +32,8 @@ typedef struct
|
||||||
int amount; /* number of tracks in the index */
|
int amount; /* number of tracks in the index */
|
||||||
} playlist_info_t;
|
} playlist_info_t;
|
||||||
|
|
||||||
|
extern playlist_info_t playlist;
|
||||||
|
|
||||||
void play_list(char *dir, char *file);
|
void play_list(char *dir, char *file);
|
||||||
char* playlist_next(int type);
|
char* playlist_next(int type);
|
||||||
void randomise_playlist( playlist_info_t *playlist, unsigned int seed );
|
void randomise_playlist( playlist_info_t *playlist, unsigned int seed );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue