diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 3 | ||||
-rw-r--r-- | apps/gui/pitchscreen.c | 284 | ||||
-rw-r--r-- | apps/screens.c | 254 |
3 files changed, 288 insertions, 253 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index c4a1cb67bb..e617d5f174 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -60,6 +60,9 @@ gui/bitmap/list.c | |||
60 | gui/charcell/list.c | 60 | gui/charcell/list.c |
61 | #endif | 61 | #endif |
62 | gui/option_select.c | 62 | gui/option_select.c |
63 | #ifdef HAVE_PITCHSCREEN | ||
64 | gui/pitchscreen.c | ||
65 | #endif | ||
63 | #ifdef HAVE_QUICKSCREEN | 66 | #ifdef HAVE_QUICKSCREEN |
64 | gui/quickscreen.c | 67 | gui/quickscreen.c |
65 | #endif | 68 | #endif |
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c new file mode 100644 index 0000000000..b790835fcb --- /dev/null +++ b/apps/gui/pitchscreen.c | |||
@@ -0,0 +1,284 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 Björn Stenberg | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <stdbool.h> | ||
21 | #include <string.h> | ||
22 | #include <stdio.h> | ||
23 | #include "config.h" | ||
24 | #include "sprintf.h" | ||
25 | #include "settings.h" | ||
26 | #include "action.h" | ||
27 | #include "system.h" | ||
28 | #include "font.h" | ||
29 | #include "misc.h" | ||
30 | #include "dsp.h" | ||
31 | #include "sound.h" | ||
32 | #include "pcmbuf.h" | ||
33 | #include "lang.h" | ||
34 | #include "icons.h" | ||
35 | #include "screen_access.h" | ||
36 | |||
37 | #define PITCH_MAX 2000 | ||
38 | #define PITCH_MIN 500 | ||
39 | #define PITCH_SMALL_DELTA 1 | ||
40 | #define PITCH_BIG_DELTA 10 | ||
41 | #define PITCH_NUDGE_DELTA 20 | ||
42 | |||
43 | #define PITCH_MODE_ABSOLUTE 1 | ||
44 | #define PITCH_MODE_SEMITONE -PITCH_MODE_ABSOLUTE | ||
45 | |||
46 | static int pitch_mode = PITCH_MODE_ABSOLUTE; /* 1 - absolute, -1 - semitone */ | ||
47 | |||
48 | /* returns: | ||
49 | 0 if no key was pressed | ||
50 | 1 if USB was connected */ | ||
51 | |||
52 | static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode) | ||
53 | { | ||
54 | unsigned char* ptr; | ||
55 | unsigned char buf[32]; | ||
56 | int w, h; | ||
57 | |||
58 | display->clear_display(); | ||
59 | |||
60 | if (display->nb_lines < 4) /* very small screen, just show the pitch value */ | ||
61 | { | ||
62 | w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_PITCH), | ||
63 | pitch / 10, pitch % 10 ); | ||
64 | display->putsxy((display->width-(w*display->char_width))/2, | ||
65 | display->nb_lines/2,buf); | ||
66 | } | ||
67 | else /* bigger screen, show everything... */ | ||
68 | { | ||
69 | |||
70 | /* UP: Pitch Up */ | ||
71 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { | ||
72 | ptr = str(LANG_PITCH_UP); | ||
73 | } else { | ||
74 | ptr = str(LANG_PITCH_UP_SEMITONE); | ||
75 | } | ||
76 | display->getstringsize(ptr,&w,&h); | ||
77 | display->putsxy((display->width-w)/2, 0, ptr); | ||
78 | display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], | ||
79 | display->width/2 - 3, h, 7, 8); | ||
80 | |||
81 | /* DOWN: Pitch Down */ | ||
82 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { | ||
83 | ptr = str(LANG_PITCH_DOWN); | ||
84 | } else { | ||
85 | ptr = str(LANG_PITCH_DOWN_SEMITONE); | ||
86 | } | ||
87 | display->getstringsize(ptr,&w,&h); | ||
88 | display->putsxy((display->width-w)/2, display->height - h, ptr); | ||
89 | display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], | ||
90 | display->width/2 - 3, display->height - h*2, 7, 8); | ||
91 | |||
92 | /* RIGHT: +2% */ | ||
93 | ptr = "+2%"; | ||
94 | display->getstringsize(ptr,&w,&h); | ||
95 | display->putsxy(display->width-w, (display->height-h)/2, ptr); | ||
96 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], | ||
97 | display->width-w-8, (display->height-h)/2, 7, 8); | ||
98 | |||
99 | /* LEFT: -2% */ | ||
100 | ptr = "-2%"; | ||
101 | display->getstringsize(ptr,&w,&h); | ||
102 | display->putsxy(0, (display->height-h)/2, ptr); | ||
103 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], | ||
104 | w+1, (display->height-h)/2, 7, 8); | ||
105 | |||
106 | /* "Pitch" */ | ||
107 | snprintf((char *)buf, sizeof(buf), str(LANG_PITCH)); | ||
108 | display->getstringsize(buf,&w,&h); | ||
109 | display->putsxy((display->width-w)/2, (display->height/2)-h, buf); | ||
110 | /* "XX.X%" */ | ||
111 | snprintf((char *)buf, sizeof(buf), "%d.%d%%", | ||
112 | pitch / 10, pitch % 10 ); | ||
113 | display->getstringsize(buf,&w,&h); | ||
114 | display->putsxy((display->width-w)/2, display->height/2, buf); | ||
115 | } | ||
116 | |||
117 | display->update(); | ||
118 | } | ||
119 | |||
120 | static int pitch_increase(int pitch, int delta, bool allow_cutoff) | ||
121 | { | ||
122 | int new_pitch; | ||
123 | |||
124 | if (delta < 0) { | ||
125 | if (pitch + delta >= PITCH_MIN) { | ||
126 | new_pitch = pitch + delta; | ||
127 | } else { | ||
128 | if (!allow_cutoff) { | ||
129 | return pitch; | ||
130 | } | ||
131 | new_pitch = PITCH_MIN; | ||
132 | } | ||
133 | } else if (delta > 0) { | ||
134 | if (pitch + delta <= PITCH_MAX) { | ||
135 | new_pitch = pitch + delta; | ||
136 | } else { | ||
137 | if (!allow_cutoff) { | ||
138 | return pitch; | ||
139 | } | ||
140 | new_pitch = PITCH_MAX; | ||
141 | } | ||
142 | } else { | ||
143 | /* delta == 0 -> no real change */ | ||
144 | return pitch; | ||
145 | } | ||
146 | sound_set_pitch(new_pitch); | ||
147 | |||
148 | return new_pitch; | ||
149 | } | ||
150 | |||
151 | /* Factor for changing the pitch one half tone up. | ||
152 | The exact value is 2^(1/12) = 1.05946309436 | ||
153 | But we use only integer arithmetics, so take | ||
154 | rounded factor multiplied by 10^5=100,000. This is | ||
155 | enough to get the same promille values as if we | ||
156 | had used floating point (checked with a spread | ||
157 | sheet). | ||
158 | */ | ||
159 | #define PITCH_SEMITONE_FACTOR 105946L | ||
160 | |||
161 | /* Some helpful constants. K is the scaling factor for SEMITONE. | ||
162 | N is for more accurate rounding | ||
163 | KN is K * N | ||
164 | */ | ||
165 | #define PITCH_K_FCT 100000UL | ||
166 | #define PITCH_N_FCT 10 | ||
167 | #define PITCH_KN_FCT 1000000UL | ||
168 | |||
169 | static int pitch_increase_semitone(int pitch, bool up) | ||
170 | { | ||
171 | uint32_t tmp; | ||
172 | uint32_t round_fct; /* How much to scale down at the end */ | ||
173 | tmp = pitch; | ||
174 | if (up) { | ||
175 | tmp = tmp * PITCH_SEMITONE_FACTOR; | ||
176 | round_fct = PITCH_K_FCT; | ||
177 | } else { | ||
178 | tmp = (tmp * PITCH_KN_FCT) / PITCH_SEMITONE_FACTOR; | ||
179 | round_fct = PITCH_N_FCT; | ||
180 | } | ||
181 | /* Scaling down with rounding */ | ||
182 | tmp = (tmp + round_fct / 2) / round_fct; | ||
183 | return pitch_increase(pitch, tmp - pitch, false); | ||
184 | } | ||
185 | |||
186 | bool pitch_screen(void) | ||
187 | { | ||
188 | int button; | ||
189 | int pitch = sound_get_pitch(); | ||
190 | int new_pitch, delta = 0; | ||
191 | bool nudged = false; | ||
192 | bool exit = false; | ||
193 | int i; | ||
194 | |||
195 | #if CONFIG_CODEC == SWCODEC | ||
196 | pcmbuf_set_low_latency(true); | ||
197 | #endif | ||
198 | |||
199 | while (!exit) | ||
200 | { | ||
201 | FOR_NB_SCREENS(i) | ||
202 | pitch_screen_draw(&screens[i], pitch, pitch_mode); | ||
203 | |||
204 | button = get_action(CONTEXT_PITCHSCREEN,TIMEOUT_BLOCK); | ||
205 | switch (button) { | ||
206 | case ACTION_PS_INC_SMALL: | ||
207 | delta = PITCH_SMALL_DELTA; | ||
208 | break; | ||
209 | |||
210 | case ACTION_PS_INC_BIG: | ||
211 | delta = PITCH_BIG_DELTA; | ||
212 | break; | ||
213 | |||
214 | case ACTION_PS_DEC_SMALL: | ||
215 | delta = -PITCH_SMALL_DELTA; | ||
216 | break; | ||
217 | |||
218 | case ACTION_PS_DEC_BIG: | ||
219 | delta = -PITCH_BIG_DELTA; | ||
220 | break; | ||
221 | |||
222 | case ACTION_PS_NUDGE_RIGHT: | ||
223 | new_pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false); | ||
224 | nudged = (new_pitch != pitch); | ||
225 | pitch = new_pitch; | ||
226 | break; | ||
227 | |||
228 | case ACTION_PS_NUDGE_RIGHTOFF: | ||
229 | if (nudged) { | ||
230 | pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false); | ||
231 | } | ||
232 | nudged = false; | ||
233 | break; | ||
234 | |||
235 | case ACTION_PS_NUDGE_LEFT: | ||
236 | new_pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false); | ||
237 | nudged = (new_pitch != pitch); | ||
238 | pitch = new_pitch; | ||
239 | break; | ||
240 | |||
241 | case ACTION_PS_NUDGE_LEFTOFF: | ||
242 | if (nudged) { | ||
243 | pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false); | ||
244 | } | ||
245 | nudged = false; | ||
246 | break; | ||
247 | |||
248 | case ACTION_PS_RESET: | ||
249 | pitch = 1000; | ||
250 | sound_set_pitch( pitch ); | ||
251 | break; | ||
252 | |||
253 | case ACTION_PS_TOGGLE_MODE: | ||
254 | pitch_mode = -pitch_mode; | ||
255 | break; | ||
256 | |||
257 | case ACTION_PS_EXIT: | ||
258 | exit = true; | ||
259 | break; | ||
260 | |||
261 | default: | ||
262 | if(default_event_handler(button) == SYS_USB_CONNECTED) | ||
263 | return 1; | ||
264 | break; | ||
265 | } | ||
266 | |||
267 | if(delta) | ||
268 | { | ||
269 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { | ||
270 | pitch = pitch_increase(pitch, delta, true); | ||
271 | } else { | ||
272 | pitch = pitch_increase_semitone(pitch, delta > 0 ? true:false); | ||
273 | } | ||
274 | |||
275 | delta = 0; | ||
276 | } | ||
277 | |||
278 | } | ||
279 | #if CONFIG_CODEC == SWCODEC | ||
280 | pcmbuf_set_low_latency(false); | ||
281 | #endif | ||
282 | lcd_setfont(FONT_UI); | ||
283 | return 0; | ||
284 | } | ||
diff --git a/apps/screens.c b/apps/screens.c index f9dd49b995..48a5a873a1 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * \/ \/ \/ \/ \/ | 7 | * \/ \/ \/ \/ \/ |
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * Copyright (C) 2002 Björn Stenberg | 10 | * Copyright (C) 2002 Björn Stenberg |
11 | * | 11 | * |
12 | * All files in this archive are subject to the GNU General Public License. | 12 | * All files in this archive are subject to the GNU General Public License. |
13 | * See the file COPYING in the source tree root for full license agreement. | 13 | * See the file COPYING in the source tree root for full license agreement. |
@@ -381,258 +381,6 @@ int charging_screen(void) | |||
381 | } | 381 | } |
382 | #endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */ | 382 | #endif /* CONFIG_CHARGING && !HAVE_POWEROFF_WHILE_CHARGING && defined(CPU_SH) */ |
383 | 383 | ||
384 | #ifdef HAVE_PITCHSCREEN | ||
385 | |||
386 | #define PITCH_MAX 2000 | ||
387 | #define PITCH_MIN 500 | ||
388 | #define PITCH_SMALL_DELTA 1 | ||
389 | #define PITCH_BIG_DELTA 10 | ||
390 | #define PITCH_NUDGE_DELTA 20 | ||
391 | |||
392 | #define PITCH_MODE_ABSOLUTE 1 | ||
393 | #define PITCH_MODE_SEMITONE -PITCH_MODE_ABSOLUTE | ||
394 | |||
395 | static int pitch_mode = PITCH_MODE_ABSOLUTE; /* 1 - absolute, -1 - semitone */ | ||
396 | |||
397 | /* returns: | ||
398 | 0 if no key was pressed | ||
399 | 1 if USB was connected */ | ||
400 | |||
401 | static void pitch_screen_draw(struct screen *display, int pitch, int pitch_mode) | ||
402 | { | ||
403 | unsigned char* ptr; | ||
404 | unsigned char buf[32]; | ||
405 | int w, h; | ||
406 | |||
407 | display->clear_display(); | ||
408 | |||
409 | if (display->nb_lines < 4) /* very small screen, just show the pitch value */ | ||
410 | { | ||
411 | w = snprintf((char *)buf, sizeof(buf), "%s: %d.%d%%",str(LANG_PITCH), | ||
412 | pitch / 10, pitch % 10 ); | ||
413 | display->putsxy((display->width-(w*display->char_width))/2, | ||
414 | display->nb_lines/2,buf); | ||
415 | } | ||
416 | else /* bigger screen, show everything... */ | ||
417 | { | ||
418 | |||
419 | /* UP: Pitch Up */ | ||
420 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { | ||
421 | ptr = str(LANG_PITCH_UP); | ||
422 | } else { | ||
423 | ptr = str(LANG_PITCH_UP_SEMITONE); | ||
424 | } | ||
425 | display->getstringsize(ptr,&w,&h); | ||
426 | display->putsxy((display->width-w)/2, 0, ptr); | ||
427 | display->mono_bitmap(bitmap_icons_7x8[Icon_UpArrow], | ||
428 | display->width/2 - 3, h, 7, 8); | ||
429 | |||
430 | /* DOWN: Pitch Down */ | ||
431 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { | ||
432 | ptr = str(LANG_PITCH_DOWN); | ||
433 | } else { | ||
434 | ptr = str(LANG_PITCH_DOWN_SEMITONE); | ||
435 | } | ||
436 | display->getstringsize(ptr,&w,&h); | ||
437 | display->putsxy((display->width-w)/2, display->height - h, ptr); | ||
438 | display->mono_bitmap(bitmap_icons_7x8[Icon_DownArrow], | ||
439 | display->width/2 - 3, display->height - h*2, 7, 8); | ||
440 | |||
441 | /* RIGHT: +2% */ | ||
442 | ptr = "+2%"; | ||
443 | display->getstringsize(ptr,&w,&h); | ||
444 | display->putsxy(display->width-w, (display->height-h)/2, ptr); | ||
445 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastForward], | ||
446 | display->width-w-8, (display->height-h)/2, 7, 8); | ||
447 | |||
448 | /* LEFT: -2% */ | ||
449 | ptr = "-2%"; | ||
450 | display->getstringsize(ptr,&w,&h); | ||
451 | display->putsxy(0, (display->height-h)/2, ptr); | ||
452 | display->mono_bitmap(bitmap_icons_7x8[Icon_FastBackward], | ||
453 | w+1, (display->height-h)/2, 7, 8); | ||
454 | |||
455 | /* "Pitch" */ | ||
456 | snprintf((char *)buf, sizeof(buf), str(LANG_PITCH)); | ||
457 | display->getstringsize(buf,&w,&h); | ||
458 | display->putsxy((display->width-w)/2, (display->height/2)-h, buf); | ||
459 | /* "XX.X%" */ | ||
460 | snprintf((char *)buf, sizeof(buf), "%d.%d%%", | ||
461 | pitch / 10, pitch % 10 ); | ||
462 | display->getstringsize(buf,&w,&h); | ||
463 | display->putsxy((display->width-w)/2, display->height/2, buf); | ||
464 | } | ||
465 | |||
466 | display->update(); | ||
467 | } | ||
468 | |||
469 | static int pitch_increase(int pitch, int delta, bool allow_cutoff) | ||
470 | { | ||
471 | int new_pitch; | ||
472 | |||
473 | if (delta < 0) { | ||
474 | if (pitch + delta >= PITCH_MIN) { | ||
475 | new_pitch = pitch + delta; | ||
476 | } else { | ||
477 | if (!allow_cutoff) { | ||
478 | return pitch; | ||
479 | } | ||
480 | new_pitch = PITCH_MIN; | ||
481 | } | ||
482 | } else if (delta > 0) { | ||
483 | if (pitch + delta <= PITCH_MAX) { | ||
484 | new_pitch = pitch + delta; | ||
485 | } else { | ||
486 | if (!allow_cutoff) { | ||
487 | return pitch; | ||
488 | } | ||
489 | new_pitch = PITCH_MAX; | ||
490 | } | ||
491 | } else { | ||
492 | /* delta == 0 -> no real change */ | ||
493 | return pitch; | ||
494 | } | ||
495 | sound_set_pitch(new_pitch); | ||
496 | |||
497 | return new_pitch; | ||
498 | } | ||
499 | |||
500 | /* Factor for changing the pitch one half tone up. | ||
501 | The exact value is 2^(1/12) = 1.05946309436 | ||
502 | But we use only integer arithmetics, so take | ||
503 | rounded factor multiplied by 10^5=100,000. This is | ||
504 | enough to get the same promille values as if we | ||
505 | had used floating point (checked with a spread | ||
506 | sheet). | ||
507 | */ | ||
508 | #define PITCH_SEMITONE_FACTOR 105946L | ||
509 | |||
510 | /* Some helpful constants. K is the scaling factor for SEMITONE. | ||
511 | N is for more accurate rounding | ||
512 | KN is K * N | ||
513 | */ | ||
514 | #define PITCH_K_FCT 100000UL | ||
515 | #define PITCH_N_FCT 10 | ||
516 | #define PITCH_KN_FCT 1000000UL | ||
517 | |||
518 | static int pitch_increase_semitone(int pitch, bool up) | ||
519 | { | ||
520 | uint32_t tmp; | ||
521 | uint32_t round_fct; /* How much to scale down at the end */ | ||
522 | tmp = pitch; | ||
523 | if (up) { | ||
524 | tmp = tmp * PITCH_SEMITONE_FACTOR; | ||
525 | round_fct = PITCH_K_FCT; | ||
526 | } else { | ||
527 | tmp = (tmp * PITCH_KN_FCT) / PITCH_SEMITONE_FACTOR; | ||
528 | round_fct = PITCH_N_FCT; | ||
529 | } | ||
530 | /* Scaling down with rounding */ | ||
531 | tmp = (tmp + round_fct / 2) / round_fct; | ||
532 | return pitch_increase(pitch, tmp - pitch, false); | ||
533 | } | ||
534 | |||
535 | bool pitch_screen(void) | ||
536 | { | ||
537 | int button; | ||
538 | int pitch = sound_get_pitch(); | ||
539 | int new_pitch, delta = 0; | ||
540 | bool nudged = false; | ||
541 | bool exit = false; | ||
542 | int i; | ||
543 | |||
544 | #if CONFIG_CODEC == SWCODEC | ||
545 | pcmbuf_set_low_latency(true); | ||
546 | #endif | ||
547 | |||
548 | while (!exit) | ||
549 | { | ||
550 | FOR_NB_SCREENS(i) | ||
551 | pitch_screen_draw(&screens[i], pitch, pitch_mode); | ||
552 | |||
553 | button = get_action(CONTEXT_PITCHSCREEN,TIMEOUT_BLOCK); | ||
554 | switch (button) { | ||
555 | case ACTION_PS_INC_SMALL: | ||
556 | delta = PITCH_SMALL_DELTA; | ||
557 | break; | ||
558 | |||
559 | case ACTION_PS_INC_BIG: | ||
560 | delta = PITCH_BIG_DELTA; | ||
561 | break; | ||
562 | |||
563 | case ACTION_PS_DEC_SMALL: | ||
564 | delta = -PITCH_SMALL_DELTA; | ||
565 | break; | ||
566 | |||
567 | case ACTION_PS_DEC_BIG: | ||
568 | delta = -PITCH_BIG_DELTA; | ||
569 | break; | ||
570 | |||
571 | case ACTION_PS_NUDGE_RIGHT: | ||
572 | new_pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false); | ||
573 | nudged = (new_pitch != pitch); | ||
574 | pitch = new_pitch; | ||
575 | break; | ||
576 | |||
577 | case ACTION_PS_NUDGE_RIGHTOFF: | ||
578 | if (nudged) { | ||
579 | pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false); | ||
580 | } | ||
581 | nudged = false; | ||
582 | break; | ||
583 | |||
584 | case ACTION_PS_NUDGE_LEFT: | ||
585 | new_pitch = pitch_increase(pitch, -PITCH_NUDGE_DELTA, false); | ||
586 | nudged = (new_pitch != pitch); | ||
587 | pitch = new_pitch; | ||
588 | break; | ||
589 | |||
590 | case ACTION_PS_NUDGE_LEFTOFF: | ||
591 | if (nudged) { | ||
592 | pitch = pitch_increase(pitch, PITCH_NUDGE_DELTA, false); | ||
593 | } | ||
594 | nudged = false; | ||
595 | break; | ||
596 | |||
597 | case ACTION_PS_RESET: | ||
598 | pitch = 1000; | ||
599 | sound_set_pitch( pitch ); | ||
600 | break; | ||
601 | |||
602 | case ACTION_PS_TOGGLE_MODE: | ||
603 | pitch_mode = -pitch_mode; | ||
604 | break; | ||
605 | |||
606 | case ACTION_PS_EXIT: | ||
607 | exit = true; | ||
608 | break; | ||
609 | |||
610 | default: | ||
611 | if(default_event_handler(button) == SYS_USB_CONNECTED) | ||
612 | return 1; | ||
613 | break; | ||
614 | } | ||
615 | |||
616 | if(delta) | ||
617 | { | ||
618 | if (pitch_mode == PITCH_MODE_ABSOLUTE) { | ||
619 | pitch = pitch_increase(pitch, delta, true); | ||
620 | } else { | ||
621 | pitch = pitch_increase_semitone(pitch, delta > 0 ? true:false); | ||
622 | } | ||
623 | |||
624 | delta = 0; | ||
625 | } | ||
626 | |||
627 | } | ||
628 | #if CONFIG_CODEC == SWCODEC | ||
629 | pcmbuf_set_low_latency(false); | ||
630 | #endif | ||
631 | lcd_setfont(FONT_UI); | ||
632 | return 0; | ||
633 | } | ||
634 | #endif /* HAVE_PITCHSCREEN */ | ||
635 | |||
636 | #if CONFIG_CHARGING | 384 | #if CONFIG_CHARGING |
637 | void charging_splash(void) | 385 | void charging_splash(void) |
638 | { | 386 | { |