1
0
Fork 0
forked from len0rd/rockbox

Updated pitch screen again. *Back to old behavior of only coming up on ON+UP/DOWN (Archos) or PLAY+UP/DOWN (iriver) - fixes FS#4928. *Button mappings changed: Up/Down = +/- 0.1%; holding Up/Down = +/- 2%; Left/Right = 'temporary' +/- 2% (old behavior). *SWCODEC: pcmbuf_set_low_latency, now you can hear pitch adjustments quicker. *Broke pitchscreen code into two parts; one to draw and one to deal with buttons.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9751 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Zakk Roberts 2006-04-21 06:11:24 +00:00
parent 375b225fac
commit 8a0ea50ee2
2 changed files with 100 additions and 64 deletions

View file

@ -612,7 +612,8 @@ long gui_wps_show(void)
/* pitch screen */
#if CONFIG_KEYPAD == RECORDER_PAD || CONFIG_KEYPAD == IRIVER_H100_PAD \
|| CONFIG_KEYPAD == IRIVER_H300_PAD
case BUTTON_ON | BUTTON_REPEAT:
case BUTTON_ON | BUTTON_UP:
case BUTTON_ON | BUTTON_DOWN:
#ifdef HAVE_LCD_COLOR
lcd_set_backdrop(gui_wps[SCREEN_MAIN].data->old_backdrop);
#endif

View file

@ -349,29 +349,24 @@ int charging_screen(void)
/* returns:
0 if no key was pressed
1 if USB was connected */
bool pitch_screen(void)
{
int button;
int pitch = sound_get_pitch();
bool exit = false;
while (!exit) {
void pitch_screen_draw(int pitch)
{
unsigned char* ptr;
unsigned char buf[32];
int w, h;
lcd_clear_display();
lcd_setfont(FONT_SYSFIXED);
/* UP: +0.1% */
ptr = "+0.1%";
/* UP: Pitch Up */
ptr = str(LANG_PITCH_UP);
lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
lcd_mono_bitmap(bitmap_icons_7x8[Icon_UpArrow],
LCD_WIDTH/2 - 3, h, 7, 8);
/* DOWN: -0.1% */
ptr = "-0.1%";
/* DOWN: Pitch Down */
ptr = str(LANG_PITCH_DOWN);
lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
lcd_mono_bitmap(bitmap_icons_7x8[Icon_DownArrow],
@ -402,41 +397,79 @@ bool pitch_screen(void)
lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT/2, buf);
lcd_update();
}
bool pitch_screen(void)
{
int button;
int pitch = sound_get_pitch();
bool exit = false;
lcd_setfont(FONT_SYSFIXED);
#if CONFIG_CODEC == SWCODEC
pcmbuf_set_low_latency(false);
#endif
while (!exit)
{
pitch_screen_draw(pitch);
/* use lastbutton, so the main loop can decide whether to
exit to browser or not */
button = button_get(true);
switch (button) {
case PITCH_UP:
case PITCH_UP | BUTTON_REPEAT:
if ( pitch < 2000 )
pitch++;
sound_set_pitch(pitch);
break;
case PITCH_UP | BUTTON_REPEAT:
if ( pitch < 1990 )
pitch += 10;
sound_set_pitch(pitch);
break;
case PITCH_DOWN:
case PITCH_DOWN | BUTTON_REPEAT:
if ( pitch > 500 )
pitch--;
sound_set_pitch(pitch);
break;
case PITCH_RIGHT:
case PITCH_RIGHT | BUTTON_REPEAT:
if ( pitch < 1980 )
pitch += 20;
else
pitch = 2000;
case PITCH_DOWN | BUTTON_REPEAT:
if ( pitch > 510 )
pitch -= 10;
sound_set_pitch(pitch);
break;
case PITCH_LEFT:
case PITCH_LEFT | BUTTON_REPEAT:
if ( pitch > 520 )
pitch -= 20;
else
pitch = 500;
case PITCH_RIGHT:
if ( pitch < 1980 )
{
pitch += 20;
sound_set_pitch(pitch);
pitch_screen_draw(pitch);
while(button != (PITCH_RIGHT|BUTTON_REL))
button = button_get(true);
pitch -= 20;
sound_set_pitch(pitch);
}
break;
case PITCH_LEFT:
if ( pitch > 520 )
{
pitch -= 20;
sound_set_pitch(pitch);
pitch_screen_draw(pitch);
while(button != (PITCH_LEFT|BUTTON_REL))
button = button_get(true);;
pitch += 20;
sound_set_pitch(pitch);
}
break;
case PITCH_RESET:
@ -454,7 +487,9 @@ bool pitch_screen(void)
break;
}
}
#if CONFIG_CODEC == SWCODEC
pcmbuf_set_low_latency(false);
#endif
lcd_setfont(FONT_UI);
return 0;
}