iRiver: more robust folder skip routines + folder navigation on main unit via

either PLAY+LEFT/RIGHT or short then long LEFT/RIGHT


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7810 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Anton Oleynikov 2005-11-10 22:31:47 +00:00
parent b060d3a520
commit 00928af4dd
5 changed files with 74 additions and 30 deletions

View File

@ -1659,15 +1659,7 @@ static void initiate_dir_change(int direction)
if(!playlist_next_dir(direction))
return;
/* Detect if disk is spinning.. */
if (filling) {
queue_post(&audio_queue, AUDIO_PLAY, 0);
} else {
new_track = 0;
ci.reload_codec = true;
if (!pcmbuf_is_crossfade_enabled())
pcmbuf_flush_audio();
}
queue_post(&audio_queue, AUDIO_PLAY, 0);
codec_track_changed();
}

View File

@ -55,6 +55,9 @@ void audio_set_track_unbuffer_event(void (*handler)(struct mp3entry *id3,
void audio_invalidate_tracks(void);
void voice_init(void);
extern void audio_next_dir(void);
extern void audio_prev_dir(void);
#endif

View File

@ -130,6 +130,8 @@
#define PLAYLIST_DISPLAY_COUNT 10
static bool changing_dir = false;
static struct playlist_info current_playlist;
static char now_playing[MAX_PATH+1];
@ -2072,6 +2074,7 @@ int playlist_next(int steps)
{
char dir[MAX_PATH+1];
changing_dir = true;
if (steps > 0)
{
if (!get_next_directory(dir))
@ -2089,19 +2092,20 @@ int playlist_next(int steps)
}
else
{
if (!get_previous_directory(dir))
{
/* start playing previous directory */
if (playlist_create(dir, NULL) != -1)
if (!get_previous_directory(dir))
{
ft_build_playlist(tree_get_context(), 0);
if (global_settings.playlist_shuffle)
playlist_shuffle(current_tick, -1);
playlist_start(current_playlist.amount-1,0);
index = current_playlist.amount-1;
/* start playing previous directory */
if (playlist_create(dir, NULL) != -1)
{
ft_build_playlist(tree_get_context(), 0);
if (global_settings.playlist_shuffle)
playlist_shuffle(current_tick, -1);
playlist_start(current_playlist.amount-1,0);
index = current_playlist.amount-1;
}
}
}
}
}
changing_dir = true;
}
return index;
@ -2154,9 +2158,22 @@ int playlist_next(int steps)
bool playlist_next_dir(int direction)
{
char dir[MAX_PATH+1];
bool result;
int res;
if (((direction > 0) && !get_next_directory(dir)) ||
((direction < 0) && !get_previous_directory(dir)))
/* not to mess up real playlists */
if(!current_playlist.in_ram)
return false;
if(changing_dir)
return false;
changing_dir = true;
if(direction > 0)
res = get_next_directory(dir);
else
res = get_previous_directory(dir);
if (!res)
{
if (playlist_create(dir, NULL) != -1)
{
@ -2164,13 +2181,17 @@ bool playlist_next_dir(int direction)
if (global_settings.playlist_shuffle)
playlist_shuffle(current_tick, -1);
playlist_start(0,0);
return true;
result = true;
}
else
return false;
result = false;
}
else
return false;
result = false;
changing_dir = false;
return result;
}
/* Get resume info for current playing song. If return value is -1 then

View File

@ -52,6 +52,7 @@
#include "sound.h"
#include "onplay.h"
#include "abrepeat.h"
#include "playback.h"
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
/* 3% of 30min file == 54s step size */
@ -64,9 +65,6 @@ static struct mp3entry* id3 = NULL;
static struct mp3entry* nid3 = NULL;
static char current_track_path[MAX_PATH+1];
void audio_next_dir(void);
void audio_prev_dir(void);
/* set volume
return true if screen restore is needed
return false otherwise
@ -337,6 +335,8 @@ long wps_show(void)
long restoretimer = 0; /* timer to delay screen redraw temporarily */
bool exit = false;
bool update_track = false;
unsigned long right_lastclick = 0;
unsigned long left_lastclick = 0;
id3 = nid3 = NULL;
current_track_path[0] = '\0';
@ -555,11 +555,29 @@ long wps_show(void)
break;
/* fast forward / rewind */
case WPS_FFWD:
case WPS_REW:
#ifdef WPS_RC_FFWD
case WPS_RC_FFWD:
#endif
case WPS_FFWD:
#ifdef WPS_NEXT_DIR
if (current_tick - right_lastclick < HZ)
{
audio_next_dir();
right_lastclick = 0;
break;
}
#endif
#ifdef WPS_RC_REW
case WPS_RC_REW:
#endif
case WPS_REW:
#ifdef WPS_PREV_DIR
if (current_tick - left_lastclick < HZ)
{
audio_prev_dir();
left_lastclick = 0;
break;
}
#endif
ffwd_rew(button);
break;
@ -577,6 +595,7 @@ long wps_show(void)
break;
#endif
#endif
left_lastclick = current_tick;
#ifdef AB_REPEAT_ENABLE
/* if we're in A/B repeat mode and the current position
@ -604,13 +623,19 @@ long wps_show(void)
}
break;
#ifdef WPS_NEXT_DIR
#ifdef WPS_RC_NEXT_DIR
case WPS_RC_NEXT_DIR:
#endif
case WPS_NEXT_DIR:
audio_next_dir();
break;
#endif
#ifdef WPS_PREV_DIR
#ifdef WPS_RC_PREV_DIR
case WPS_RC_PREV_DIR:
#endif
case WPS_PREV_DIR:
audio_prev_dir();
break;
#endif
@ -628,6 +653,7 @@ long wps_show(void)
break;
#endif
#endif
right_lastclick = current_tick;
#ifdef AB_REPEAT_ENABLE
/* if we're in A/B repeat mode and the current position is

View File

@ -43,6 +43,8 @@
#define WPS_ID3 (BUTTON_MODE | BUTTON_ON)
#define WPS_CONTEXT (BUTTON_SELECT | BUTTON_REPEAT)
#define WPS_QUICK (BUTTON_MODE | BUTTON_REPEAT)
#define WPS_NEXT_DIR (BUTTON_RIGHT | BUTTON_ON)
#define WPS_PREV_DIR (BUTTON_LEFT | BUTTON_ON)
#define WPS_RC_NEXT_DIR (BUTTON_RC_BITRATE | BUTTON_REL)
#define WPS_RC_PREV_DIR (BUTTON_RC_SOURCE | BUTTON_REL)