summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Oleynikov <len0x@rockbox.org>2005-11-10 22:31:47 +0000
committerAnton Oleynikov <len0x@rockbox.org>2005-11-10 22:31:47 +0000
commit00928af4dd25b00ee337502ec37952fbe7d01322 (patch)
tree1096269001caa7d1c883d2d276ea38a18f858eec
parentb060d3a52041c557f145974ea8e8ea589d529fc1 (diff)
downloadrockbox-00928af4dd25b00ee337502ec37952fbe7d01322.tar.gz
rockbox-00928af4dd25b00ee337502ec37952fbe7d01322.zip
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
-rw-r--r--apps/playback.c10
-rw-r--r--apps/playback.h3
-rw-r--r--apps/playlist.c53
-rw-r--r--apps/wps.c36
-rw-r--r--apps/wps.h2
5 files changed, 74 insertions, 30 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 8f300f5145..01c1dd6a94 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -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();
}
diff --git a/apps/playback.h b/apps/playback.h
index 0fb5d5c319..8128cc2490 100644
--- a/apps/playback.h
+++ b/apps/playback.h
@@ -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
diff --git a/apps/playlist.c b/apps/playlist.c
index 8bf1fd2116..c43174b0b6 100644
--- a/apps/playlist.c
+++ b/apps/playlist.c
@@ -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;
+
+ /* not to mess up real playlists */
+ if(!current_playlist.in_ram)
+ return false;
+
+ if(changing_dir)
+ return false;
- if (((direction > 0) && !get_next_directory(dir)) ||
- ((direction < 0) && !get_previous_directory(dir)))
+ 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
diff --git a/apps/wps.c b/apps/wps.c
index 7a9a5de60b..31fcd2cb6d 100644
--- a/apps/wps.c
+++ b/apps/wps.c
@@ -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,12 +555,30 @@ 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
diff --git a/apps/wps.h b/apps/wps.h
index b8499984a8..a419c809f0 100644
--- a/apps/wps.h
+++ b/apps/wps.h
@@ -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)