From 6224cdb16677cae7b65b0598eec3381a6fb6a4aa Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Fri, 16 Aug 2002 14:41:47 +0000 Subject: Added resume. Works in dirs and playlists, shuffled or not. Resumes mid-song, but press pause on players before you shutdown so they get a chance to store the position on disk. Recorders use RTC ram. Todo: Time display is wrong after mid-track resume and ffd/rew is not handled. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1787 a1c6a512-1295-4272-9138-f99709370657 --- apps/playlist.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'apps/playlist.c') diff --git a/apps/playlist.c b/apps/playlist.c index 0cb9d09f32..f3081397f6 100644 --- a/apps/playlist.c +++ b/apps/playlist.c @@ -66,7 +66,7 @@ int playlist_add(char *filename) return 0; } -char* playlist_next(int steps) +char* playlist_next(int steps, int* index) { int seek; int max; @@ -103,7 +103,9 @@ char* playlist_next(int steps) else return NULL; } - + + if (index) + *index = playlist.index; /* Zero-terminate the file name */ seek=0; @@ -165,7 +167,11 @@ char* playlist_next(int steps) } } -void play_list(char *dir, char *file, int start_index) +void play_list(char *dir, + char *file, + int start_index, + int start_offset, + int random_seed ) { char *sep=""; int dirlen; @@ -211,7 +217,7 @@ void play_list(char *dir, char *file, int start_index) status_draw(); lcd_update(); } - randomise_playlist( current_tick ); + randomise_playlist( random_seed ); } if(!playlist.in_ram) { @@ -220,7 +226,7 @@ void play_list(char *dir, char *file, int start_index) lcd_update(); } /* also make the first song get playing */ - mpeg_play(playlist_next(0)); + mpeg_play(start_offset); } /* -- cgit v1.2.3