summaryrefslogtreecommitdiffstats
path: root/apps/gui/gwps-common.c
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 /apps/gui/gwps-common.c
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
Diffstat (limited to 'apps/gui/gwps-common.c')
-rw-r--r--apps/gui/gwps-common.c14
1 files changed, 3 insertions, 11 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;