summaryrefslogtreecommitdiff
path: root/apps
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
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')
-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)
196 unsigned int max_step = 0; /* maximum ff/rewind step */ 196 unsigned int max_step = 0; /* maximum ff/rewind step */
197 int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */ 197 int ff_rewind_count = 0; /* current ff/rewind count (in ticks) */
198 int direction = -1; /* forward=1 or backward=-1 */ 198 int direction = -1; /* forward=1 or backward=-1 */
199 long accel_tick = 0; /* next time at which to bump the step size */
200 bool exit = false; 199 bool exit = false;
201 bool usb = false; 200 bool usb = false;
202 int i = 0; 201 int i = 0;
202 const long ff_rw_accel = (global_settings.ff_rewind_accel + 3);
203 203
204 if (button == ACTION_NONE) 204 if (button == ACTION_NONE)
205 { 205 {
@@ -237,13 +237,8 @@ bool ffwd_rew(int button)
237 237
238 ff_rewind_count += step * direction; 238 ff_rewind_count += step * direction;
239 239
240 if (global_settings.ff_rewind_accel != 0 && 240 /* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */
241 current_tick >= accel_tick) 241 step += step >> ff_rw_accel;
242 {
243 step *= 2;
244 accel_tick = current_tick +
245 global_settings.ff_rewind_accel*HZ;
246 }
247 } 242 }
248 else 243 else
249 { 244 {
@@ -268,9 +263,6 @@ bool ffwd_rew(int button)
268 wps_state.ff_rewind = true; 263 wps_state.ff_rewind = true;
269 264
270 step = 1000 * global_settings.ff_rewind_min_step; 265 step = 1000 * global_settings.ff_rewind_min_step;
271
272 accel_tick = current_tick +
273 global_settings.ff_rewind_accel*HZ;
274 } 266 }
275 else 267 else
276 break; 268 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 @@
11750 gigabeatf: "High" 11750 gigabeatf: "High"
11751 </voice> 11751 </voice>
11752</phrase> 11752</phrase>
11753<phrase>
11754 id: LANG_VERY_SLOW
11755 desc: in settings_menu
11756 user:
11757 <source>
11758 *: none
11759 gigabeatf: "Very slow"
11760 </source>
11761 <dest>
11762 *: none
11763 gigabeatf: "Very slow"
11764 </dest>
11765 <voice>
11766 *: none
11767 gigabeatf: "Very slow"
11768 </voice>
11769</phrase>
11770<phrase>
11771 id: LANG_SLOW
11772 desc: in settings_menu
11773 user:
11774 <source>
11775 *: none
11776 gigabeatf: "Slow"
11777 </source>
11778 <dest>
11779 *: none
11780 gigabeatf: "Slow"
11781 </dest>
11782 <voice>
11783 *: none
11784 gigabeatf: "Slow"
11785 </voice>
11786</phrase>
11787<phrase>
11788 id: LANG_VERY_FAST
11789 desc: in settings_menu
11790 user:
11791 <source>
11792 *: none
11793 gigabeatf: "Very fast"
11794 </source>
11795 <dest>
11796 *: none
11797 gigabeatf: "Very fast"
11798 </dest>
11799 <voice>
11800 *: none
11801 gigabeatf: "Very fast"
11802 </voice>
11803</phrase>
11804<phrase>
11805 id: LANG_FAST
11806 desc: in settings_menu
11807 user:
11808 <source>
11809 *: none
11810 gigabeatf: "Fast"
11811 </source>
11812 <dest>
11813 *: none
11814 gigabeatf: "Fast"
11815 </dest>
11816 <voice>
11817 *: none
11818 gigabeatf: "Fast"
11819 </voice>
11820</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)
1109static uint32_t wvs_ff_rw(int btn, unsigned refresh) 1109static uint32_t wvs_ff_rw(int btn, unsigned refresh)
1110{ 1110{
1111 unsigned int step = TS_SECOND*rb->global_settings->ff_rewind_min_step; 1111 unsigned int step = TS_SECOND*rb->global_settings->ff_rewind_min_step;
1112 const long ff_rw_accel = rb->global_settings->ff_rewind_accel; 1112 const long ff_rw_accel = (rb->global_settings->ff_rewind_accel + 3);
1113 long accel_tick = *rb->current_tick + ff_rw_accel*HZ;
1114 uint32_t start; 1113 uint32_t start;
1115 uint32_t time = stream_get_seek_time(&start); 1114 uint32_t time = stream_get_seek_time(&start);
1116 const uint32_t duration = stream_get_duration(); 1115 const uint32_t duration = stream_get_duration();
@@ -1145,7 +1144,6 @@ static uint32_t wvs_ff_rw(int btn, unsigned refresh)
1145 1144
1146 while (1) 1145 while (1)
1147 { 1146 {
1148 long tick = *rb->current_tick;
1149 stream_keep_disk_active(); 1147 stream_keep_disk_active();
1150 1148
1151 switch (btn) 1149 switch (btn)
@@ -1199,10 +1197,8 @@ static uint32_t wvs_ff_rw(int btn, unsigned refresh)
1199 1197
1200 ff_rw_count += step; 1198 ff_rw_count += step;
1201 1199
1202 if (ff_rw_accel != 0 && TIME_AFTER(tick, accel_tick)) { 1200 /* smooth seeking by multiplying step by: 1 + (2 ^ -accel) */
1203 step *= 2; 1201 step += step >> ff_rw_accel;
1204 accel_tick = tick + ff_rw_accel*HZ;
1205 }
1206 1202
1207 if (wvs.status == WVS_STATUS_FF) { 1203 if (wvs.status == WVS_STATUS_FF) {
1208 if (duration - time <= ff_rw_count) 1204 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[] = {
666 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step, 666 TABLE_SETTING(F_ALLOW_ARBITRARY_VALS, ff_rewind_min_step,
667 LANG_FFRW_STEP, 1, "scan min step", NULL, UNIT_SEC, 667 LANG_FFRW_STEP, 1, "scan min step", NULL, UNIT_SEC,
668 NULL, NULL, NULL, 14, 1,2,3,4,5,6,8,10,15,20,25,30,45,60), 668 NULL, NULL, NULL, 14, 1,2,3,4,5,6,8,10,15,20,25,30,45,60),
669 INT_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 3, "scan accel", UNIT_SEC, 669 CHOICE_SETTING(0, ff_rewind_accel, LANG_FFRW_ACCEL, 2,
670 16, 0, -1, scanaccel_formatter, getlang_unit_0_is_off, NULL), 670 "seek accel", "very fast,fast,normal,slow,very slow", NULL, 5,
671 ID2P(LANG_VERY_FAST), ID2P(LANG_FAST), ID2P(LANG_NORMAL),
672 ID2P(LANG_SLOW) , ID2P(LANG_VERY_SLOW)),
671#if (CONFIG_CODEC == SWCODEC) && !defined(HAVE_FLASH_STORAGE) 673#if (CONFIG_CODEC == SWCODEC) && !defined(HAVE_FLASH_STORAGE)
672 STRINGCHOICE_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0,"antiskip", 674 STRINGCHOICE_SETTING(0, buffer_margin, LANG_MP3BUFFER_MARGIN, 0,"antiskip",
673 "5s,15s,30s,1min,2min,3min,5min,10min", NULL, 8, 675 "5s,15s,30s,1min,2min,3min,5min,10min", NULL, 8,