diff options
-rw-r--r-- | apps/screens.c | 45 | ||||
-rw-r--r-- | firmware/mpeg.c | 13 |
2 files changed, 44 insertions, 14 deletions
diff --git a/apps/screens.c b/apps/screens.c index d8a2aeacd1..5a912d9d60 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -116,12 +116,10 @@ void usb_screen(void) | |||
116 | 2 if USB was connected */ | 116 | 2 if USB was connected */ |
117 | int on_screen(void) | 117 | int on_screen(void) |
118 | { | 118 | { |
119 | static int pitch = 100; | 119 | static int pitch = 1000; |
120 | bool exit = false; | 120 | bool exit = false; |
121 | bool used = false; | 121 | bool used = false; |
122 | 122 | ||
123 | lcd_setfont(FONT_SYSFIXED); | ||
124 | |||
125 | while (!exit) { | 123 | while (!exit) { |
126 | 124 | ||
127 | if ( used ) { | 125 | if ( used ) { |
@@ -131,14 +129,15 @@ int on_screen(void) | |||
131 | 129 | ||
132 | lcd_scroll_pause(); | 130 | lcd_scroll_pause(); |
133 | lcd_clear_display(); | 131 | lcd_clear_display(); |
134 | 132 | lcd_setfont(FONT_SYSFIXED); | |
133 | |||
135 | ptr = str(LANG_PITCH_UP); | 134 | ptr = str(LANG_PITCH_UP); |
136 | lcd_getstringsize(ptr,&w,&h); | 135 | lcd_getstringsize(ptr,&w,&h); |
137 | lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); | 136 | lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); |
138 | lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow], | 137 | lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow], |
139 | LCD_WIDTH/2 - 3, h*2, 7, 8, true); | 138 | LCD_WIDTH/2 - 3, h*2, 7, 8, true); |
140 | 139 | ||
141 | snprintf(buf, sizeof buf, "%d%%", pitch); | 140 | snprintf(buf, sizeof buf, "%d.%d%%", pitch / 10, pitch % 10 ); |
142 | lcd_getstringsize(buf,&w,&h); | 141 | lcd_getstringsize(buf,&w,&h); |
143 | lcd_putsxy((LCD_WIDTH-w)/2, h, buf); | 142 | lcd_putsxy((LCD_WIDTH-w)/2, h, buf); |
144 | 143 | ||
@@ -165,8 +164,8 @@ int on_screen(void) | |||
165 | case BUTTON_ON | BUTTON_UP | BUTTON_REPEAT: | 164 | case BUTTON_ON | BUTTON_UP | BUTTON_REPEAT: |
166 | used = true; | 165 | used = true; |
167 | pitch++; | 166 | pitch++; |
168 | if ( pitch > 200 ) | 167 | if ( pitch > 2000 ) |
169 | pitch = 200; | 168 | pitch = 2000; |
170 | #ifdef HAVE_MAS3587F | 169 | #ifdef HAVE_MAS3587F |
171 | mpeg_set_pitch(pitch); | 170 | mpeg_set_pitch(pitch); |
172 | #endif | 171 | #endif |
@@ -177,8 +176,8 @@ int on_screen(void) | |||
177 | case BUTTON_ON | BUTTON_DOWN | BUTTON_REPEAT: | 176 | case BUTTON_ON | BUTTON_DOWN | BUTTON_REPEAT: |
178 | used = true; | 177 | used = true; |
179 | pitch--; | 178 | pitch--; |
180 | if ( pitch < 50 ) | 179 | if ( pitch < 500 ) |
181 | pitch = 50; | 180 | pitch = 500; |
182 | #ifdef HAVE_MAS3587F | 181 | #ifdef HAVE_MAS3587F |
183 | mpeg_set_pitch(pitch); | 182 | mpeg_set_pitch(pitch); |
184 | #endif | 183 | #endif |
@@ -199,6 +198,34 @@ int on_screen(void) | |||
199 | exit = true; | 198 | exit = true; |
200 | break; | 199 | break; |
201 | 200 | ||
201 | case BUTTON_ON | BUTTON_RIGHT: | ||
202 | if ( pitch < 2000 ) { | ||
203 | pitch += 20; | ||
204 | mpeg_set_pitch(pitch); | ||
205 | } | ||
206 | break; | ||
207 | |||
208 | case BUTTON_RIGHT | BUTTON_REL: | ||
209 | if ( pitch > 500 ) { | ||
210 | pitch -= 20; | ||
211 | mpeg_set_pitch(pitch); | ||
212 | } | ||
213 | break; | ||
214 | |||
215 | case BUTTON_ON | BUTTON_LEFT: | ||
216 | if ( pitch > 500 ) { | ||
217 | pitch -= 20; | ||
218 | mpeg_set_pitch(pitch); | ||
219 | } | ||
220 | break; | ||
221 | |||
222 | case BUTTON_LEFT | BUTTON_REL: | ||
223 | if ( pitch < 2000 ) { | ||
224 | pitch += 20; | ||
225 | mpeg_set_pitch(pitch); | ||
226 | } | ||
227 | break; | ||
228 | |||
202 | #ifdef SIMULATOR | 229 | #ifdef SIMULATOR |
203 | case BUTTON_ON: | 230 | case BUTTON_ON: |
204 | #else | 231 | #else |
diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 85054d7cf0..d75ac2085e 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c | |||
@@ -1985,16 +1985,19 @@ void mpeg_sound_channel_config(int configuration) | |||
1985 | #ifdef HAVE_MAS3587F | 1985 | #ifdef HAVE_MAS3587F |
1986 | /* This function works by telling the decoder that we have another | 1986 | /* This function works by telling the decoder that we have another |
1987 | crystal frequency than we actually have. It will adjust its internal | 1987 | crystal frequency than we actually have. It will adjust its internal |
1988 | parameters and the result is that the audio is played at another pitch */ | 1988 | parameters and the result is that the audio is played at another pitch. |
1989 | void mpeg_set_pitch(int percent) | 1989 | |
1990 | The pitch value is in tenths of percent. | ||
1991 | */ | ||
1992 | void mpeg_set_pitch(int pitch) | ||
1990 | { | 1993 | { |
1991 | unsigned long val; | 1994 | unsigned long val; |
1992 | 1995 | ||
1993 | /* invert percent value */ | 1996 | /* invert pitch value */ |
1994 | percent = 10000/percent; | 1997 | pitch = 1000000/pitch; |
1995 | 1998 | ||
1996 | /* Calculate the new (bogus) frequency */ | 1999 | /* Calculate the new (bogus) frequency */ |
1997 | val = 18432*percent/100; | 2000 | val = 18432*pitch/1000; |
1998 | 2001 | ||
1999 | mas_writemem(MAS_BANK_D0,0x7f3,&val,1); | 2002 | mas_writemem(MAS_BANK_D0,0x7f3,&val,1); |
2000 | 2003 | ||