summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-10-17 16:05:23 +0000
committerThomas Martitz <kugel@rockbox.org>2009-10-17 16:05:23 +0000
commita7c888c48ed65a49b81c44159c1293ea790c4acf (patch)
tree88087a95bd86099fd1e84d0236aa0ce7ec8d6953 /apps
parent88b1efd92579248c4d17d1edf7a7b02041c0e003 (diff)
downloadrockbox-a7c888c48ed65a49b81c44159c1293ea790c4acf.tar.gz
rockbox-a7c888c48ed65a49b81c44159c1293ea790c4acf.tar.bz2
rockbox-a7c888c48ed65a49b81c44159c1293ea790c4acf.zip
Add a option to skip length which lets you skip 5s before the end of a song, which can be useful on gapless albums.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23229 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/wps.c28
-rw-r--r--apps/lang/english.lang14
-rw-r--r--apps/settings_list.c8
3 files changed, 40 insertions, 10 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 342ebdea2b..a74e3d449d 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -71,7 +71,7 @@
#define RESTORE_WPS_INSTANTLY 0l
#define RESTORE_WPS_NEXT_SECOND ((long)(HZ+current_tick))
/* in milliseconds */
-#define DEFAULT_SKIP_TRESH 3000ul
+#define DEFAULT_SKIP_TRESH 3000l
#define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */
@@ -494,11 +494,26 @@ static void next_track(void)
static void play_hop(int direction)
{
- unsigned long step = ((unsigned long)global_settings.skip_length)*1000;
- unsigned long elapsed = wps_state.id3->elapsed;
- unsigned long remaining = wps_state.id3->length - elapsed;
+ long step = global_settings.skip_length*1000;
+ long elapsed = wps_state.id3->elapsed;
+ long remaining = wps_state.id3->length - elapsed;
- if (!global_settings.prevent_skip &&
+ if (step < 0)
+ {
+ if (direction < 0)
+ {
+ prev_track(DEFAULT_SKIP_TRESH);
+ return;
+ }
+ else if (remaining < DEFAULT_SKIP_TRESH*2)
+ {
+ next_track();
+ return;
+ }
+ else
+ elapsed += (remaining - DEFAULT_SKIP_TRESH*2);
+ }
+ else if (!global_settings.prevent_skip &&
(!step ||
(direction > 0 && step >= remaining) ||
(direction < 0 && elapsed < DEFAULT_SKIP_TRESH)))
@@ -509,8 +524,7 @@ static void play_hop(int direction)
prev_track(DEFAULT_SKIP_TRESH);
return;
}
-
- if (direction == 1 && step >= remaining)
+ else if (direction == 1 && step >= remaining)
{
#if CONFIG_CODEC == SWCODEC
if(global_settings.beep)
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 8be7380225..15ee6d2936 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -13075,3 +13075,17 @@
swcodec: "Release Time"
</voice>
</phrase>
+<phrase>
+ id: LANG_SKIP_OUTRO
+ desc: skipping to the 5 seconds before the end of a track
+ user: core
+ <source>
+ *: "Skip to Outro"
+ </source>
+ <dest>
+ *: "Skip to Outro"
+ </dest>
+ <voice>
+ *: "Skip to Outro"
+ </voice>
+</phrase>
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 62a9351782..27675ca0b8 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -291,7 +291,9 @@ static const char* formatter_unit_0_is_skip_track(char *buffer, size_t buffer_si
int val, const char *unit)
{
(void)unit;
- if (val == 0)
+ if (val == -1)
+ return str(LANG_SKIP_OUTRO);
+ else if (val == 0)
return str(LANG_SKIP_TRACK);
else if (val % 60 == 0)
snprintf(buffer, buffer_size, "%d min", val/60);
@@ -1459,10 +1461,10 @@ const struct settings_list settings[] = {
NULL),
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, skip_length,
LANG_SKIP_LENGTH, 0, "skip length",
- "track,1s,2s,3s,5s,7s,10s,15s,20s,30s,45s,1min,90s,2min,3min,5min,10min,15min",
+ "outro,track,1s,2s,3s,5s,7s,10s,15s,20s,30s,45s,1min,90s,2min,3min,5min,10min,15min",
UNIT_SEC, formatter_unit_0_is_skip_track,
getlang_unit_0_is_skip_track, NULL,
- 18, 0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900),
+ 19, -1,0,1,2,3,5,7,10,15,20,30,45,60,90,120,180,300,600,900),
CHOICE_SETTING(0, start_in_screen, LANG_START_SCREEN, 1,
"start in screen", "previous,root,files,"
#ifdef HAVE_TAGCACHE