summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-10-18 12:05:15 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-10-18 12:05:15 +0000
commit0834d3f322abf9fc9058be1135e78a061ec46bd4 (patch)
treee62bdc6f6dd7a4c65263412a816231c7214dcbe8
parent8ca78b666522ca3a4f13d6baf26da112a77c7220 (diff)
downloadrockbox-0834d3f322abf9fc9058be1135e78a061ec46bd4.zip
rockbox-0834d3f322abf9fc9058be1135e78a061ec46bd4.tar.gz
rockbox-0834d3f322abf9fc9058be1135e78a061ec46bd4.tar.bz2
rockbox-0834d3f322abf9fc9058be1135e78a061ec46bd4.tar.xz
Pitch steps changed to 0.1% instead of 1%.
Holding down ON+RIGHT/LEFT increases/decreses pitch 2% while key is held down, then returns. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2718 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/screens.c45
-rw-r--r--firmware/mpeg.c13
2 files changed, 44 insertions, 14 deletions
diff --git a/apps/screens.c b/apps/screens.c
index d8a2aea..5a912d9 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -116,12 +116,10 @@ void usb_screen(void)
2 if USB was connected */
int on_screen(void)
{
- static int pitch = 100;
+ static int pitch = 1000;
bool exit = false;
bool used = false;
- lcd_setfont(FONT_SYSFIXED);
-
while (!exit) {
if ( used ) {
@@ -131,14 +129,15 @@ int on_screen(void)
lcd_scroll_pause();
lcd_clear_display();
-
+ lcd_setfont(FONT_SYSFIXED);
+
ptr = str(LANG_PITCH_UP);
lcd_getstringsize(ptr,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow],
LCD_WIDTH/2 - 3, h*2, 7, 8, true);
- snprintf(buf, sizeof buf, "%d%%", pitch);
+ snprintf(buf, sizeof buf, "%d.%d%%", pitch / 10, pitch % 10 );
lcd_getstringsize(buf,&w,&h);
lcd_putsxy((LCD_WIDTH-w)/2, h, buf);
@@ -165,8 +164,8 @@ int on_screen(void)
case BUTTON_ON | BUTTON_UP | BUTTON_REPEAT:
used = true;
pitch++;
- if ( pitch > 200 )
- pitch = 200;
+ if ( pitch > 2000 )
+ pitch = 2000;
#ifdef HAVE_MAS3587F
mpeg_set_pitch(pitch);
#endif
@@ -177,8 +176,8 @@ int on_screen(void)
case BUTTON_ON | BUTTON_DOWN | BUTTON_REPEAT:
used = true;
pitch--;
- if ( pitch < 50 )
- pitch = 50;
+ if ( pitch < 500 )
+ pitch = 500;
#ifdef HAVE_MAS3587F
mpeg_set_pitch(pitch);
#endif
@@ -199,6 +198,34 @@ int on_screen(void)
exit = true;
break;
+ case BUTTON_ON | BUTTON_RIGHT:
+ if ( pitch < 2000 ) {
+ pitch += 20;
+ mpeg_set_pitch(pitch);
+ }
+ break;
+
+ case BUTTON_RIGHT | BUTTON_REL:
+ if ( pitch > 500 ) {
+ pitch -= 20;
+ mpeg_set_pitch(pitch);
+ }
+ break;
+
+ case BUTTON_ON | BUTTON_LEFT:
+ if ( pitch > 500 ) {
+ pitch -= 20;
+ mpeg_set_pitch(pitch);
+ }
+ break;
+
+ case BUTTON_LEFT | BUTTON_REL:
+ if ( pitch < 2000 ) {
+ pitch += 20;
+ mpeg_set_pitch(pitch);
+ }
+ break;
+
#ifdef SIMULATOR
case BUTTON_ON:
#else
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index 85054d7..d75ac20 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -1985,16 +1985,19 @@ void mpeg_sound_channel_config(int configuration)
#ifdef HAVE_MAS3587F
/* This function works by telling the decoder that we have another
crystal frequency than we actually have. It will adjust its internal
- parameters and the result is that the audio is played at another pitch */
-void mpeg_set_pitch(int percent)
+ parameters and the result is that the audio is played at another pitch.
+
+ The pitch value is in tenths of percent.
+*/
+void mpeg_set_pitch(int pitch)
{
unsigned long val;
- /* invert percent value */
- percent = 10000/percent;
+ /* invert pitch value */
+ pitch = 1000000/pitch;
/* Calculate the new (bogus) frequency */
- val = 18432*percent/100;
+ val = 18432*pitch/1000;
mas_writemem(MAS_BANK_D0,0x7f3,&val,1);