Index: settings.c =================================================================== RCS file: /cvsroot/rockbox/apps/settings.c,v retrieving revision 1.44 diff -u -r1.44 settings.c --- settings.c 31 Aug 2002 04:58:35 -0000 1.44 +++ settings.c 31 Aug 2002 23:23:52 -0000 @@ -68,7 +68,7 @@ 0x0d 0x21 0x0e 0x22 0x0f 0x23 -0x10 0x24 +0x10 0x24 0x11 0x25 0x12 0x26 <(int) Resume playlist index, or -1 if no playlist resume> 0x16 0x2a <(int) Byte offset into resume file> @@ -271,7 +271,9 @@ ((global_settings.scroll_speed << 3) | (global_settings.wps_display & 7)); - config_block[0x10] = (unsigned char)global_settings.ff_rewind_accel; + config_block[0x10] = (unsigned char) + ((global_settings.ff_rewind_min_step & 15) << 4 | + (global_settings.ff_rewind_accel & 15)); config_block[0x11] = (unsigned char)global_settings.avc; config_block[0x1a] = (unsigned char)global_settings.disk_spindown; @@ -364,8 +366,10 @@ if (c != 7) global_settings.wps_display = c; - if (config_block[0x10] != 0xFF) - global_settings.ff_rewind_accel = config_block[0x10]; + if (config_block[0x10] != 0xFF) { + global_settings.ff_rewind_min_step = (config_block[0x10] >> 4) & 15; + global_settings.ff_rewind_accel = config_block[0x10] & 15; + } if (config_block[0x11] != 0xFF) global_settings.avc = config_block[0x11]; @@ -425,6 +429,7 @@ global_settings.total_uptime = 0; global_settings.scroll_speed = 8; global_settings.show_hidden_files = false; + global_settings.ff_rewind_min_step = DEFAULT_FF_REWIND_MIN_STEP; global_settings.ff_rewind_accel = DEFAULT_FF_REWIND_ACCEL_SETTING; global_settings.resume_index = -1; global_settings.resume_offset = -1; Index: settings.h =================================================================== RCS file: /cvsroot/rockbox/apps/settings.h,v retrieving revision 1.32 diff -u -r1.32 settings.h --- settings.h 30 Aug 2002 13:49:31 -0000 1.32 +++ settings.h 31 Aug 2002 23:23:52 -0000 @@ -29,6 +29,21 @@ #define RESUME_ASK 1 #define RESUME_ON 2 +#define FF_REWIND_1000 0 +#define FF_REWIND_2000 1 +#define FF_REWIND_3000 2 +#define FF_REWIND_4000 3 +#define FF_REWIND_5000 4 +#define FF_REWIND_6000 5 +#define FF_REWIND_8000 6 +#define FF_REWIND_10000 7 +#define FF_REWIND_15000 8 +#define FF_REWIND_20000 9 +#define FF_REWIND_25000 10 +#define FF_REWIND_30000 11 +#define FF_REWIND_45000 12 +#define FF_REWIND_60000 13 + struct user_settings { /* audio settings */ @@ -63,6 +78,7 @@ bool sort_case; /* dir sort order: 0=case insensitive, 1=sensitive */ int scroll_speed; /* long texts scrolling speed: 1-20 */ bool playlist_shuffle; + int ff_rewind_min_step; /* FF/Rewind minimum step size */ int ff_rewind_accel; /* FF/Rewind acceleration (in seconds per doubling) */ int disk_spindown; /* time until disk spindown, in seconds (0=off) */ @@ -120,6 +136,7 @@ #define DEFAULT_POWEROFF_SETTING 0 #define DEFAULT_BACKLIGHT_SETTING 5 #define DEFAULT_WPS_DISPLAY 0 +#define DEFAULT_FF_REWIND_MIN_STEP FF_REWIND_1000 #define DEFAULT_FF_REWIND_ACCEL_SETTING 3 #endif /* __SETTINGS_H__ */ Index: settings_menu.c =================================================================== RCS file: /cvsroot/rockbox/apps/settings_menu.c,v retrieving revision 1.40 diff -u -r1.40 settings_menu.c --- settings_menu.c 31 Aug 2002 04:58:35 -0000 1.40 +++ settings_menu.c 31 Aug 2002 23:23:52 -0000 @@ -165,6 +165,17 @@ return MENU_OK; } +static Menu ff_rewind_min_step(void) +{ + char* names[] = { "1s ", "2s ", "3s ", "4s ", + "5s ", "6s ", "8s ", "10s", + "15s", "20s", "25s", "30s", + "45s", "60s" }; + set_option("[FF/rewind min step]", &global_settings.ff_rewind_min_step, + names, 14 ); + return MENU_OK; +} + static Menu ff_rewind_accel(void) { char* names[] = { "off ", "2x/1s ", "2x/2s ", "2x/3s ", @@ -196,6 +207,7 @@ { "Time/Date", timedate_set }, #endif { "Show hidden files", show_hidden_files }, + { "FF/Rewind", ff_rewind_min_step }, { "FF/Rewind Accel", ff_rewind_accel }, { "Resume", resume }, { "Disk spindown", spindown }, Index: wps-display.c =================================================================== RCS file: /cvsroot/rockbox/apps/wps-display.c,v retrieving revision 1.8 diff -u -r1.8 wps-display.c --- wps-display.c 31 Aug 2002 11:54:19 -0000 1.8 +++ wps-display.c 31 Aug 2002 23:23:52 -0000 @@ -552,7 +552,7 @@ } #if defined(HAVE_LCD_CHARCELLS) && !defined(SIMULATOR) -bool draw_player_progress(struct mp3entry* id3, int ff_rewwind_count) +bool draw_player_progress(struct mp3entry* id3, int ff_rewind_count) { if(!id3) return(false); @@ -564,9 +564,9 @@ memset(binline, 1, sizeof binline); memset(player_progressbar, 1, sizeof player_progressbar); if(wps_time_countup == false) - songpos = ((id3->elapsed - ff_rewwind_count) * 36) / id3->length; + songpos = ((id3->elapsed - ff_rewind_count) * 36) / id3->length; else - songpos = ((id3->elapsed + ff_rewwind_count) * 36) / id3->length; + songpos = ((id3->elapsed + ff_rewind_count) * 36) / id3->length; for (i=0; i < songpos; i++) binline[i] = 0; Index: wps.c =================================================================== RCS file: /cvsroot/rockbox/apps/wps.c,v retrieving revision 1.128 diff -u -r1.128 wps.c --- wps.c 31 Aug 2002 12:49:01 -0000 1.128 +++ wps.c 31 Aug 2002 23:23:53 -0000 @@ -44,7 +44,6 @@ #include "ajf.h" #endif -#define FF_REWIND_MIN_STEP 1000 /* minimum ff/rewind step is 1 second */ #define FF_REWIND_MAX_PERCENT 3 /* cap ff/rewind step size at max % of file */ /* 3% of 30min file == 54s step size */ @@ -294,30 +293,41 @@ } #endif +static int ff_rew_steps[] = { + 1000, 2000, 3000, 4000, + 5000, 6000, 8000, 10000, + 15000, 20000, 25000, 30000, + 45000, 60000 +}; + static bool ffwd_rew(int button) { - unsigned int ff_rewind_step = 0; /* current rewind step size */ - unsigned int ff_rewind_max_step = 0; /* max rewind step size */ - int ff_rewind_count = 0; - long ff_rewind_accel_tick = 0; /* next time to bump ff/rewind step size */ + unsigned int step = 0; /* current ff/rewind step */ + 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; while (!exit) { switch ( button ) { case BUTTON_LEFT | BUTTON_REPEAT: + case BUTTON_RIGHT | BUTTON_REPEAT: if (ff_rewind) { - ff_rewind_count -= ff_rewind_step; + ff_rewind_count += step * direction; + if (global_settings.ff_rewind_accel != 0 && - current_tick >= ff_rewind_accel_tick) + current_tick >= accel_tick) { - ff_rewind_step *= 2; - if (ff_rewind_step > ff_rewind_max_step) - ff_rewind_step = ff_rewind_max_step; - ff_rewind_accel_tick = current_tick + - global_settings.ff_rewind_accel*HZ; - } + step *= 2; + if (step > max_step) + step = max_step; + + accel_tick = current_tick + + global_settings.ff_rewind_accel*HZ; + } } else { @@ -328,96 +338,48 @@ #ifdef HAVE_PLAYER_KEYPAD lcd_stop_scroll(); #endif - status_set_playmode(STATUS_FASTBACKWARD); + direction = (button & BUTTON_RIGHT) ? 1 : -1; + + if (direction > 0) + status_set_playmode(STATUS_FASTFORWARD); + else + status_set_playmode(STATUS_FASTBACKWARD); + ff_rewind = true; - ff_rewind_max_step = - id3->length * FF_REWIND_MAX_PERCENT / 100; - ff_rewind_step = FF_REWIND_MIN_STEP; - if (ff_rewind_step > ff_rewind_max_step) - ff_rewind_step = ff_rewind_max_step; - ff_rewind_count = -ff_rewind_step; - ff_rewind_accel_tick = current_tick + - global_settings.ff_rewind_accel*HZ; - } - else - break; - } - if ((int)(id3->elapsed + ff_rewind_count) < 0) - ff_rewind_count = -id3->elapsed; + step = ff_rew_steps[global_settings.ff_rewind_min_step]; - if(wps_time_countup == false) - wps_refresh(id3, -ff_rewind_count, false); - else - wps_refresh(id3, ff_rewind_count, false); - break; + max_step = id3->length * FF_REWIND_MAX_PERCENT / 100; - case BUTTON_RIGHT | BUTTON_REPEAT: - if (ff_rewind) - { - ff_rewind_count += ff_rewind_step; - if (global_settings.ff_rewind_accel != 0 && - current_tick >= ff_rewind_accel_tick) - { - ff_rewind_step *= 2; - if (ff_rewind_step > ff_rewind_max_step) - ff_rewind_step = ff_rewind_max_step; - ff_rewind_accel_tick = current_tick + - global_settings.ff_rewind_accel*HZ; - } - } - else - { - if ( mpeg_is_playing() && id3 && id3->length ) - { - if (!paused) - mpeg_pause(); -#ifdef HAVE_PLAYER_KEYPAD - lcd_stop_scroll(); -#endif - status_set_playmode(STATUS_FASTFORWARD); - ff_rewind = true; - ff_rewind_max_step = - id3->length * FF_REWIND_MAX_PERCENT / 100; - ff_rewind_step = FF_REWIND_MIN_STEP; - if (ff_rewind_step > ff_rewind_max_step) - ff_rewind_step = ff_rewind_max_step; - ff_rewind_count = ff_rewind_step; - ff_rewind_accel_tick = current_tick + - global_settings.ff_rewind_accel*HZ; + if (step > max_step) + step = max_step; + + ff_rewind_count = step * direction; + accel_tick = current_tick + + global_settings.ff_rewind_accel*HZ; } else break; } - if ((id3->elapsed + ff_rewind_count) > id3->length) - ff_rewind_count = id3->length - id3->elapsed; + if (direction > 0) { + if ((id3->elapsed + ff_rewind_count) > id3->length) + ff_rewind_count = id3->length - id3->elapsed; + } + else { + if ((int)(id3->elapsed + ff_rewind_count) < 0) + ff_rewind_count = -id3->elapsed; + } - if(wps_time_countup == false) + if (wps_time_countup == false) wps_refresh(id3, -ff_rewind_count, false); else wps_refresh(id3, ff_rewind_count, false); - break; - case BUTTON_LEFT | BUTTON_REL: - /* rewind */ - mpeg_ff_rewind(ff_rewind_count); - ff_rewind_count = 0; - ff_rewind = false; - if (paused) - status_set_playmode(STATUS_PAUSE); - else { - mpeg_resume(); - status_set_playmode(STATUS_PLAY); - } -#ifdef HAVE_LCD_CHARCELLS - wps_display(id3); -#endif - exit = true; break; + case BUTTON_LEFT | BUTTON_REL: case BUTTON_RIGHT | BUTTON_REL: - /* fast forward */ mpeg_ff_rewind(ff_rewind_count); ff_rewind_count = 0; ff_rewind = false;