summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2008-06-28 17:55:53 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2008-06-28 17:55:53 +0000
commit2fb70bcabb1c871baf17ace7a82f9fda9ab721c6 (patch)
tree9047a029a90fd88805a09f5c85e1f8eb39de37c0
parentbcf9b5dfa6c575ac70271bdddf3ee7e5c1b0c9c6 (diff)
downloadrockbox-2fb70bcabb1c871baf17ace7a82f9fda9ab721c6.tar.gz
rockbox-2fb70bcabb1c871baf17ace7a82f9fda9ab721c6.zip
implement smooth seeking acceleration for audio playback and mpegplayer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17843 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/gwps-common.c14
-rw-r--r--apps/lang/english.lang68
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c10
-rw-r--r--apps/settings_list.c6
4 files changed, 78 insertions, 20 deletions
diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c
index b53d68d6ba..3fd77a2211 100644
--- a/apps/gui/gwps-common.c
+++ b/apps/gui/gwps-common.c
@@ -196,10 +196,10 @@ bool ffwd_rew(int button)
unsigned int max_step = 0; /* maximum ff/rewind step */
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
int direction = -1; /* forward=1 or backward=-1 */
- long accel_tick = 0; /* next time at which to bump the step size */
bool exit = false;
bool usb = false;
int i = 0;
+ const long ff_rw_accel = (global_settings.ff_rewind_accel + 3);
if (button == ACTION_NONE)
{
@@ -237,13 +237,8 @@ bool ffwd_rew(int button)
ff_rewind_count += step * direction;
- if (global_settings.ff_rewind_accel != 0 &&
- current_tick >= accel_tick)
- {
- step *= 2;
- accel_tick = current_tick +
- global_settings.ff_rewind_accel*HZ;
- }
+ /* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */
+ step += step >> ff_rw_accel;
}
else
{
@@ -268,9 +263,6 @@ bool ffwd_rew(int button)
wps_state.ff_rewind = true;
step = 1000 * global_settings.ff_rewind_min_step;
-
- accel_tick = current_tick +
- global_settings.ff_rewind_accel*HZ;
}
else
break;
diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index 757fa58bb6..02ecdd5ad9 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -11750,3 +11750,71 @@
gigabeatf: "High"
</voice>
</phrase>
+<phrase>
+ id: LANG_VERY_SLOW
+ desc: in settings_menu
+ user:
+ <source>
+ *: none
+ gigabeatf: "Very slow"
+ </source>
+ <dest>
+ *: none
+ gigabeatf: "Very slow"
+ </dest>
+ <voice>
+ *: none
+ gigabeatf: "Very slow"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_SLOW
+ desc: in settings_menu
+ user:
+ <source>
+ *: none
+ gigabeatf: "Slow"
+ </source>
+ <dest>
+ *: none
+ gigabeatf: "Slow"
+ </dest>
+ <voice>
+ *: none
+ gigabeatf: "Slow"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_VERY_FAST
+ desc: in settings_menu
+ user:
+ <source>
+ *: none
+ gigabeatf: "Very fast"
+ </source>
+ <dest>
+ *: none
+ gigabeatf: "Very fast"
+ </dest>
+ <voice>
+ *: none
+ gigabeatf: "Very fast"
+ </voice>
+</phrase>
+<phrase>
+ id: LANG_FAST
+ desc: in settings_menu
+ user:
+ <source>
+ *: none
+ gigabeatf: "Fast"
+ </source>
+ <dest>
+ *: none
+ gigabeatf: "Fast"
+ </dest>
+ <voice>
+ *: none
+ gigabeatf: "Fast"
+ </voice>
+</phrase>
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 6d6aa2078f..5b478d0bf7 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -1109,8 +1109,7 @@ static int wvs_get_status(void)
static uint32_t wvs_ff_rw(int btn, unsigned refresh)
{
unsigned int step = TS_SECOND*rb->global_settings->ff_rewind_min_step;
- const long ff_rw_accel = rb->global_settings->ff_rewind_accel;
- long accel_tick = *rb->current_tick + ff_rw_accel*HZ;
+ const long ff_rw_accel = (rb->global_settings->ff_rewind_accel + 3);
uint32_t start;
uint32_t time = stream_get_seek_time(&start);
const uint32_t duration = stream_get_duration();
@@ -1145,7 +1144,6 @@ static uint32_t wvs_ff_rw(int btn, unsigned refresh)
while (1)
{
- long tick = *rb->current_tick;
stream_keep_disk_active();
switch (btn)
@@ -1199,10 +1197,8 @@ static uint32_t wvs_ff_rw(int btn, unsigned refresh)
ff_rw_count += step;
- if (ff_rw_accel != 0 && TIME_AFTER(tick, accel_tick)) {
- step *= 2;
- accel_tick = tick + ff_rw_accel*HZ;
- }
+ /* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */
+ step += step >> ff_rw_accel;
if (wvs.status == WVS_STATUS_FF) {
if (duration - time <= ff_rw_count)
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 6007570bf8..1e9bd185b7 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -666,8 +666,10 @@ const struct settings_list settings[] = {
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step,
LANG_FFRW_STEP, 1, "scan min step", NULL, UNIT_SEC,
NULL, NULL, NULL, 14, 1,2,3,4,5,6,8,10,15,20,25,30,45,60),
- INT_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 3, "scan accel", UNIT_SEC,
- 16, 0, -1, scanaccel_formatter, getlang_unit_0_is_off, NULL),
+ CHOICE_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 2,
+ "seek accel", "very fast,fast,normal,slow,very slow", NULL, 5,
+ ID2P(LANG_VERY_FAST), ID2P(LANG_FAST), ID2P(LANG_NORMAL),
+ ID2P(LANG_SLOW) , ID2P(LANG_VERY_SLOW)),
#if (CONFIG_CODEC == SWCODEC) && !defined(HAVE_FLASH_STORAGE)
STRINGCHOICE_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0,"antiskip",
"5s,15s,30s,1min,2min,3min,5min,10min", NULL, 8,