forked from len0rd/rockbox
implement smooth seeking acceleration for audio playback and mpegplayer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17843 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
bcf9b5dfa6
commit
2fb70bcabb
4 changed files with 78 additions and 20 deletions
|
@ -196,10 +196,10 @@ bool ffwd_rew(int button)
|
||||||
unsigned int max_step = 0; /* maximum ff/rewind step */
|
unsigned int max_step = 0; /* maximum ff/rewind step */
|
||||||
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
|
int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
|
||||||
int direction = -1; /* forward=1 or backward=-1 */
|
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 exit = false;
|
||||||
bool usb = false;
|
bool usb = false;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
const long ff_rw_accel = (global_settings.ff_rewind_accel + 3);
|
||||||
|
|
||||||
if (button == ACTION_NONE)
|
if (button == ACTION_NONE)
|
||||||
{
|
{
|
||||||
|
@ -237,13 +237,8 @@ bool ffwd_rew(int button)
|
||||||
|
|
||||||
ff_rewind_count += step * direction;
|
ff_rewind_count += step * direction;
|
||||||
|
|
||||||
if (global_settings.ff_rewind_accel != 0 &&
|
/* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */
|
||||||
current_tick >= accel_tick)
|
step += step >> ff_rw_accel;
|
||||||
{
|
|
||||||
step *= 2;
|
|
||||||
accel_tick = current_tick +
|
|
||||||
global_settings.ff_rewind_accel*HZ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -268,9 +263,6 @@ bool ffwd_rew(int button)
|
||||||
wps_state.ff_rewind = true;
|
wps_state.ff_rewind = true;
|
||||||
|
|
||||||
step = 1000 * global_settings.ff_rewind_min_step;
|
step = 1000 * global_settings.ff_rewind_min_step;
|
||||||
|
|
||||||
accel_tick = current_tick +
|
|
||||||
global_settings.ff_rewind_accel*HZ;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11750,3 +11750,71 @@
|
||||||
gigabeatf: "High"
|
gigabeatf: "High"
|
||||||
</voice>
|
</voice>
|
||||||
</phrase>
|
</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>
|
||||||
|
|
|
@ -1109,8 +1109,7 @@ static int wvs_get_status(void)
|
||||||
static uint32_t wvs_ff_rw(int btn, unsigned refresh)
|
static uint32_t wvs_ff_rw(int btn, unsigned refresh)
|
||||||
{
|
{
|
||||||
unsigned int step = TS_SECOND*rb->global_settings->ff_rewind_min_step;
|
unsigned int step = TS_SECOND*rb->global_settings->ff_rewind_min_step;
|
||||||
const long ff_rw_accel = rb->global_settings->ff_rewind_accel;
|
const long ff_rw_accel = (rb->global_settings->ff_rewind_accel + 3);
|
||||||
long accel_tick = *rb->current_tick + ff_rw_accel*HZ;
|
|
||||||
uint32_t start;
|
uint32_t start;
|
||||||
uint32_t time = stream_get_seek_time(&start);
|
uint32_t time = stream_get_seek_time(&start);
|
||||||
const uint32_t duration = stream_get_duration();
|
const uint32_t duration = stream_get_duration();
|
||||||
|
@ -1145,7 +1144,6 @@ static uint32_t wvs_ff_rw(int btn, unsigned refresh)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
long tick = *rb->current_tick;
|
|
||||||
stream_keep_disk_active();
|
stream_keep_disk_active();
|
||||||
|
|
||||||
switch (btn)
|
switch (btn)
|
||||||
|
@ -1199,10 +1197,8 @@ static uint32_t wvs_ff_rw(int btn, unsigned refresh)
|
||||||
|
|
||||||
ff_rw_count += step;
|
ff_rw_count += step;
|
||||||
|
|
||||||
if (ff_rw_accel != 0 && TIME_AFTER(tick, accel_tick)) {
|
/* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */
|
||||||
step *= 2;
|
step += step >> ff_rw_accel;
|
||||||
accel_tick = tick + ff_rw_accel*HZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wvs.status == WVS_STATUS_FF) {
|
if (wvs.status == WVS_STATUS_FF) {
|
||||||
if (duration - time <= ff_rw_count)
|
if (duration - time <= ff_rw_count)
|
||||||
|
|
|
@ -666,8 +666,10 @@ const struct settings_list settings[] = {
|
||||||
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step,
|
TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step,
|
||||||
LANG_FFRW_STEP, 1, "scan min step", NULL, UNIT_SEC,
|
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),
|
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,
|
CHOICE_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 2,
|
||||||
16, 0, -1, scanaccel_formatter, getlang_unit_0_is_off, NULL),
|
"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)
|
#if (CONFIG_CODEC == SWCODEC) && !defined(HAVE_FLASH_STORAGE)
|
||||||
STRINGCHOICE_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0,"antiskip",
|
STRINGCHOICE_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0,"antiskip",
|
||||||
"5s,15s,30s,1min,2min,3min,5min,10min", NULL, 8,
|
"5s,15s,30s,1min,2min,3min,5min,10min", NULL, 8,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue