From 8e8e2627b27b28a855881db09f2c16bfb2193050 Mon Sep 17 00:00:00 2001 From: Michael Chicoine Date: Wed, 6 Jan 2010 14:48:42 +0000 Subject: FS#10856 - Skip to previous track inconsistent when using cuesheet git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24191 a1c6a512-1295-4272-9138-f99709370657 --- apps/cuesheet.c | 14 +++++++++++++- apps/gui/wps.c | 3 --- apps/gui/wps.h | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/cuesheet.c b/apps/cuesheet.c index 7c631c72c8..ef1eff8a85 100644 --- a/apps/cuesheet.c +++ b/apps/cuesheet.c @@ -39,6 +39,7 @@ #include "plugin.h" #include "playback.h" #include "cuesheet.h" +#include "gui/wps.h" #define CUE_DIR ROCKBOX_DIR "/cue" @@ -328,7 +329,18 @@ bool curr_cuesheet_skip(struct cuesheet *cue, int direction, unsigned long curr_ else { if (!(direction <= 0 && track == 0)) - track += direction; + { + /* If skipping forward, skip to next cuesheet segment. If skipping + backward before DEFAULT_SKIP_TRESH milliseconds have elapsed, skip + to previous cuesheet segment. If skipping backward after + DEFAULT_SKIP_TRESH seconds have elapsed, skip to the start of the + current cuesheet segment */ + if (direction == 1 || + ((curr_pos - cue->tracks[track].offset) < DEFAULT_SKIP_TRESH)) + { + track += direction; + } + } seek(cue->tracks[track].offset); return true; diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 69285c0bf1..14fb848ebe 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -70,9 +70,6 @@ #define RESTORE_WPS_INSTANTLY 0l #define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick)) -/* in milliseconds */ -#define DEFAULT_SKIP_TRESH 3000l - #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ /* 3% of 30min file == 54s step size */ diff --git a/apps/gui/wps.h b/apps/gui/wps.h index 76932a323a..0aa496748b 100644 --- a/apps/gui/wps.h +++ b/apps/gui/wps.h @@ -43,4 +43,7 @@ bool is_wps_fading(void); int wps_get_ff_rewind_count(void); #endif /* IPOD_ACCESSORY_PROTOCOL */ +/* in milliseconds */ +#define DEFAULT_SKIP_TRESH 3000l + #endif /* _WPS_H_ */ -- cgit v1.2.3