diff options
author | Eric Linenberg <elinenbe@umich.edu> | 2002-08-28 19:34:07 +0000 |
---|---|---|
committer | Eric Linenberg <elinenbe@umich.edu> | 2002-08-28 19:34:07 +0000 |
commit | 65240761fbcee1274836b74295c10247ca3d8ceb (patch) | |
tree | 34e5d0021c17042f151e75acd99761ed79ede73a | |
parent | 7d808a83e41156c99081d8df54fd6c2067bec8d0 (diff) | |
download | rockbox-65240761fbcee1274836b74295c10247ca3d8ceb.tar.gz rockbox-65240761fbcee1274836b74295c10247ca3d8ceb.zip |
Nate Nystrom's ff/rw acceleration patch
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2044 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/settings.c | 9 | ||||
-rw-r--r-- | apps/settings.h | 3 | ||||
-rw-r--r-- | apps/settings_menu.c | 11 | ||||
-rw-r--r-- | apps/wps.c | 46 |
4 files changed, 63 insertions, 6 deletions
diff --git a/apps/settings.c b/apps/settings.c index ef74a5bb92..bb64886efd 100644 --- a/apps/settings.c +++ b/apps/settings.c | |||
@@ -65,10 +65,12 @@ offset abs | |||
65 | 0x0d 0x21 <resume settings byte> | 65 | 0x0d 0x21 <resume settings byte> |
66 | 0x0e 0x22 <shuffle,mp3filter,sort_case,discharge,statusbar,show_hidden> | 66 | 0x0e 0x22 <shuffle,mp3filter,sort_case,discharge,statusbar,show_hidden> |
67 | 0x0f 0x23 <scroll speed & WPS display byte> | 67 | 0x0f 0x23 <scroll speed & WPS display byte> |
68 | 0x10 0x24 <playlist options byte> | 68 | 0x10 0x24 <ff/rewind step size> |
69 | 0x11 0x25 <AVC byte> | 69 | 0x11 0x25 <AVC byte> |
70 | 0x12 0x26 <(int) Resume playlist index, or -1 if no playlist resume> | 70 | 0x12 0x26 <(int) Resume playlist index, or -1 if no playlist resume> |
71 | 0x16 0x2a <(int) Byte offset into resume file> | 71 | 0x16 0x2a <(int) Byte offset into resume file> |
72 | 0x1a 0x2e <time until disk spindown> | ||
73 | 0x1b 0x2f <ff/rewind acceleration rate> | ||
72 | 74 | ||
73 | <all unused space filled with 0xff> | 75 | <all unused space filled with 0xff> |
74 | 76 | ||
@@ -269,6 +271,7 @@ int settings_save( void ) | |||
269 | config_block[0x10] = (unsigned char)global_settings.ff_rewind; | 271 | config_block[0x10] = (unsigned char)global_settings.ff_rewind; |
270 | config_block[0x11] = (unsigned char)global_settings.avc; | 272 | config_block[0x11] = (unsigned char)global_settings.avc; |
271 | config_block[0x1a] = (unsigned char)global_settings.disk_spindown; | 273 | config_block[0x1a] = (unsigned char)global_settings.disk_spindown; |
274 | config_block[0x1b] = (unsigned char)global_settings.ff_rewind_accel; | ||
272 | 275 | ||
273 | memcpy(&config_block[0x12], &global_settings.resume_index, 4); | 276 | memcpy(&config_block[0x12], &global_settings.resume_index, 4); |
274 | memcpy(&config_block[0x16], &global_settings.resume_offset, 4); | 277 | memcpy(&config_block[0x16], &global_settings.resume_offset, 4); |
@@ -373,6 +376,9 @@ void settings_load(void) | |||
373 | if (config_block[0x1a] != 0xFF) | 376 | if (config_block[0x1a] != 0xFF) |
374 | global_settings.disk_spindown = config_block[0x1a]; | 377 | global_settings.disk_spindown = config_block[0x1a]; |
375 | 378 | ||
379 | if (config_block[0x1b] != 0xFF) | ||
380 | global_settings.ff_rewind_accel = config_block[0x1b]; | ||
381 | |||
376 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); | 382 | memcpy(&global_settings.resume_seed, &config_block[0xF8], 4); |
377 | 383 | ||
378 | if (config_block[0x24] != 0xFF) | 384 | if (config_block[0x24] != 0xFF) |
@@ -419,6 +425,7 @@ void settings_reset(void) { | |||
419 | global_settings.scroll_speed = 8; | 425 | global_settings.scroll_speed = 8; |
420 | global_settings.show_hidden_files = false; | 426 | global_settings.show_hidden_files = false; |
421 | global_settings.ff_rewind = DEFAULT_FF_REWIND_SETTING; | 427 | global_settings.ff_rewind = DEFAULT_FF_REWIND_SETTING; |
428 | global_settings.ff_rewind_accel = DEFAULT_FF_REWIND_ACCEL_SETTING; | ||
422 | global_settings.resume_index = -1; | 429 | global_settings.resume_index = -1; |
423 | global_settings.resume_offset = -1; | 430 | global_settings.resume_offset = -1; |
424 | global_settings.disk_spindown = 5; | 431 | global_settings.disk_spindown = 5; |
diff --git a/apps/settings.h b/apps/settings.h index 91ffb3ed90..b67af46bd7 100644 --- a/apps/settings.h +++ b/apps/settings.h | |||
@@ -64,6 +64,7 @@ struct user_settings | |||
64 | int scroll_speed; /* long texts scrolling speed: 1-20 */ | 64 | int scroll_speed; /* long texts scrolling speed: 1-20 */ |
65 | bool playlist_shuffle; | 65 | bool playlist_shuffle; |
66 | int ff_rewind; /* FF/Rewind step size (in seconds) */ | 66 | int ff_rewind; /* FF/Rewind step size (in seconds) */ |
67 | int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */ | ||
67 | int disk_spindown; /* time until disk spindown, in seconds (0=off) */ | 68 | int disk_spindown; /* time until disk spindown, in seconds (0=off) */ |
68 | 69 | ||
69 | /* while playing screen settings */ | 70 | /* while playing screen settings */ |
@@ -78,7 +79,6 @@ struct user_settings | |||
78 | 79 | ||
79 | /* geeky persistent statistics */ | 80 | /* geeky persistent statistics */ |
80 | unsigned int total_uptime; /* total uptime since rockbox was first booted */ | 81 | unsigned int total_uptime; /* total uptime since rockbox was first booted */ |
81 | |||
82 | }; | 82 | }; |
83 | 83 | ||
84 | /* prototypes */ | 84 | /* prototypes */ |
@@ -116,5 +116,6 @@ extern struct user_settings global_settings; | |||
116 | #define DEFAULT_BACKLIGHT_SETTING 5 | 116 | #define DEFAULT_BACKLIGHT_SETTING 5 |
117 | #define DEFAULT_WPS_DISPLAY 0 | 117 | #define DEFAULT_WPS_DISPLAY 0 |
118 | #define DEFAULT_FF_REWIND_SETTING 2 | 118 | #define DEFAULT_FF_REWIND_SETTING 2 |
119 | #define DEFAULT_FF_REWIND_ACCEL_SETTING 3 | ||
119 | 120 | ||
120 | #endif /* __SETTINGS_H__ */ | 121 | #endif /* __SETTINGS_H__ */ |
diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 9f36d3be2b..ffc6f6aab9 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c | |||
@@ -179,6 +179,16 @@ static Menu spindown(void) | |||
179 | return MENU_OK; | 179 | return MENU_OK; |
180 | } | 180 | } |
181 | 181 | ||
182 | static Menu ff_rewind_accel(void) | ||
183 | { | ||
184 | char* names[] = { "off ", "2x/1s ", "2x/2s ", "2x/3s ", | ||
185 | "2x/4s ", "2x/5s ", "2x/6s ", "2x/7s ", | ||
186 | "2x/8s ", "2x/9s ", "2x/10s" }; | ||
187 | set_option("[FF/Rewind Accel]", &global_settings.ff_rewind_accel, | ||
188 | names, 11 ); | ||
189 | return MENU_OK; | ||
190 | } | ||
191 | |||
182 | Menu settings_menu(void) | 192 | Menu settings_menu(void) |
183 | { | 193 | { |
184 | int m; | 194 | int m; |
@@ -200,6 +210,7 @@ Menu settings_menu(void) | |||
200 | #endif | 210 | #endif |
201 | { "Show hidden files", show_hidden_files }, | 211 | { "Show hidden files", show_hidden_files }, |
202 | { "FF/Rewind", ff_rewind }, | 212 | { "FF/Rewind", ff_rewind }, |
213 | { "FF/Rewind Accel", ff_rewind_accel }, | ||
203 | { "Resume", resume }, | 214 | { "Resume", resume }, |
204 | { "Disk spindown", spindown }, | 215 | { "Disk spindown", spindown }, |
205 | }; | 216 | }; |
diff --git a/apps/wps.c b/apps/wps.c index 38e9aa43af..55afd4da73 100644 --- a/apps/wps.c +++ b/apps/wps.c | |||
@@ -44,6 +44,9 @@ | |||
44 | #include "ajf.h" | 44 | #include "ajf.h" |
45 | #endif | 45 | #endif |
46 | 46 | ||
47 | #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ | ||
48 | /* 3% of 30min file == 54s step size */ | ||
49 | |||
47 | #ifdef HAVE_LCD_BITMAP | 50 | #ifdef HAVE_LCD_BITMAP |
48 | #define PLAY_DISPLAY_2LINEID3 0 | 51 | #define PLAY_DISPLAY_2LINEID3 0 |
49 | #define PLAY_DISPLAY_FILENAME_SCROLL 1 | 52 | #define PLAY_DISPLAY_FILENAME_SCROLL 1 |
@@ -714,6 +717,9 @@ int wps_show(void) | |||
714 | int old_release_mask; | 717 | int old_release_mask; |
715 | int button; | 718 | int button; |
716 | int ff_rewind_count = 0; | 719 | int ff_rewind_count = 0; |
720 | unsigned int ff_rewind_step = 0; /* current rewind step size */ | ||
721 | unsigned int ff_rewind_max_step = 0; /* max rewind step size */ | ||
722 | long ff_rewind_accel_tick = 0; /* next time to bump ff/rewind step size */ | ||
717 | bool ignore_keyup = true; | 723 | bool ignore_keyup = true; |
718 | bool restore = false; | 724 | bool restore = false; |
719 | 725 | ||
@@ -853,7 +859,16 @@ int wps_show(void) | |||
853 | { | 859 | { |
854 | if (ff_rewind) | 860 | if (ff_rewind) |
855 | { | 861 | { |
856 | ff_rewind_count -= global_settings.ff_rewind*1000; | 862 | ff_rewind_count -= ff_rewind_step; |
863 | if (global_settings.ff_rewind_accel != 0 && | ||
864 | current_tick >= ff_rewind_accel_tick) | ||
865 | { | ||
866 | ff_rewind_step *= 2; | ||
867 | if (ff_rewind_step > ff_rewind_max_step) | ||
868 | ff_rewind_step = ff_rewind_max_step; | ||
869 | ff_rewind_accel_tick = current_tick + | ||
870 | global_settings.ff_rewind_accel*HZ; | ||
871 | } | ||
857 | } | 872 | } |
858 | else | 873 | else |
859 | { | 874 | { |
@@ -867,7 +882,14 @@ int wps_show(void) | |||
867 | status_set_playmode(STATUS_FASTBACKWARD); | 882 | status_set_playmode(STATUS_FASTBACKWARD); |
868 | status_draw(); | 883 | status_draw(); |
869 | ff_rewind = true; | 884 | ff_rewind = true; |
870 | ff_rewind_count = -global_settings.ff_rewind*1000; | 885 | ff_rewind_max_step = |
886 | id3->length * FF_REWIND_MAX_PERCENT / 100; | ||
887 | ff_rewind_step = global_settings.ff_rewind*1000; | ||
888 | if (ff_rewind_step > ff_rewind_max_step) | ||
889 | ff_rewind_step = ff_rewind_max_step; | ||
890 | ff_rewind_count = -ff_rewind_step; | ||
891 | ff_rewind_accel_tick = current_tick + | ||
892 | global_settings.ff_rewind_accel*HZ; | ||
871 | } | 893 | } |
872 | else | 894 | else |
873 | break; | 895 | break; |
@@ -886,7 +908,16 @@ int wps_show(void) | |||
886 | { | 908 | { |
887 | if (ff_rewind) | 909 | if (ff_rewind) |
888 | { | 910 | { |
889 | ff_rewind_count += global_settings.ff_rewind*1000; | 911 | ff_rewind_count += ff_rewind_step; |
912 | if (global_settings.ff_rewind_accel != 0 && | ||
913 | current_tick >= ff_rewind_accel_tick) | ||
914 | { | ||
915 | ff_rewind_step *= 2; | ||
916 | if (ff_rewind_step > ff_rewind_max_step) | ||
917 | ff_rewind_step = ff_rewind_max_step; | ||
918 | ff_rewind_accel_tick = current_tick + | ||
919 | global_settings.ff_rewind_accel*HZ; | ||
920 | } | ||
890 | } | 921 | } |
891 | else | 922 | else |
892 | { | 923 | { |
@@ -900,7 +931,14 @@ int wps_show(void) | |||
900 | status_set_playmode(STATUS_FASTFORWARD); | 931 | status_set_playmode(STATUS_FASTFORWARD); |
901 | status_draw(); | 932 | status_draw(); |
902 | ff_rewind = true; | 933 | ff_rewind = true; |
903 | ff_rewind_count = global_settings.ff_rewind*1000; | 934 | ff_rewind_max_step = |
935 | id3->length * FF_REWIND_MAX_PERCENT / 100; | ||
936 | ff_rewind_step = global_settings.ff_rewind*1000; | ||
937 | if (ff_rewind_step > ff_rewind_max_step) | ||
938 | ff_rewind_step = ff_rewind_max_step; | ||
939 | ff_rewind_count = ff_rewind_step; | ||
940 | ff_rewind_accel_tick = current_tick + | ||
941 | global_settings.ff_rewind_accel*HZ; | ||
904 | } | 942 | } |
905 | else | 943 | else |
906 | break; | 944 | break; |