diff options
author | Hristo Kovachev <bger@rockbox.org> | 2006-02-08 13:08:55 +0000 |
---|---|---|
committer | Hristo Kovachev <bger@rockbox.org> | 2006-02-08 13:08:55 +0000 |
commit | db734b41d5004fabd7a0cb110040d7a05bd0adb4 (patch) | |
tree | 4da56be9128183f1d33a130435b1e1600f5eab42 /apps/recorder | |
parent | dcc9a8a3d8171d1f7df22a405764f7b9c194c88f (diff) | |
download | rockbox-db734b41d5004fabd7a0cb110040d7a05bd0adb4.tar.gz rockbox-db734b41d5004fabd7a0cb110040d7a05bd0adb4.zip |
Patch #1403437 by Peter D'Hoye & Martin Scarratt: Recording gain.
Changes:
***1. all platforms:
1.1 corrects gain display bug;
1.2 allows combined setting of stereo gain without an extra
line on the display;
2. iRiver H1xx and H3xx specific:
2.1 correctly named the decimator variables, they were
called 'gain';
2.2 splitted decimator gain settings for mic and line-in so
that they are saved separately;
2.3 added combined analog and decimator gain setting giving a
smooth gain range with the best analog/decimator gain
combination
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8627 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder')
-rw-r--r-- | apps/recorder/radio.c | 2 | ||||
-rw-r--r-- | apps/recorder/recording.c | 481 |
2 files changed, 403 insertions, 80 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c index 5e40425d30..073d537f24 100644 --- a/apps/recorder/radio.c +++ b/apps/recorder/radio.c | |||
@@ -357,7 +357,7 @@ bool radio_screen(void) | |||
357 | sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); | 357 | sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); |
358 | #else | 358 | #else |
359 | uda1380_enable_recording(false); | 359 | uda1380_enable_recording(false); |
360 | uda1380_set_recvol(10, 10, AUDIO_GAIN_ADC); | 360 | uda1380_set_recvol(10, 10, AUDIO_GAIN_DECIMATOR); |
361 | uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN); | 361 | uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN); |
362 | uda1380_set_monitor(true); | 362 | uda1380_set_monitor(true); |
363 | 363 | ||
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c index e611e25d15..2d31419cbb 100644 --- a/apps/recorder/recording.c +++ b/apps/recorder/recording.c | |||
@@ -134,44 +134,85 @@ static void set_gain(void) | |||
134 | { | 134 | { |
135 | if(global_settings.rec_source == SOURCE_MIC) | 135 | if(global_settings.rec_source == SOURCE_MIC) |
136 | { | 136 | { |
137 | audio_set_recording_gain(global_settings.rec_mic_gain, 0, AUDIO_GAIN_MIC); | 137 | audio_set_recording_gain(global_settings.rec_mic_gain, |
138 | 0, AUDIO_GAIN_MIC); | ||
139 | #ifdef HAVE_UDA1380 | ||
140 | audio_set_recording_gain(global_settings.rec_mic_decimator_left_gain, | ||
141 | global_settings.rec_mic_decimator_right_gain, | ||
142 | AUDIO_GAIN_DECIMATOR); | ||
143 | #endif | ||
138 | } | 144 | } |
139 | else | 145 | else |
140 | { | 146 | { |
141 | audio_set_recording_gain(global_settings.rec_left_gain, | 147 | audio_set_recording_gain(global_settings.rec_left_gain, |
142 | global_settings.rec_right_gain, AUDIO_GAIN_LINEIN); | 148 | global_settings.rec_right_gain, |
143 | } | 149 | AUDIO_GAIN_LINEIN); |
144 | #ifdef HAVE_UDA1380 | 150 | #ifdef HAVE_UDA1380 |
145 | audio_set_recording_gain(global_settings.rec_adc_left_gain, | 151 | audio_set_recording_gain(global_settings.rec_linein_decimator_left_gain, |
146 | global_settings.rec_adc_right_gain, | 152 | global_settings.rec_linein_decimator_right_gain, |
147 | AUDIO_GAIN_ADC); | 153 | AUDIO_GAIN_DECIMATOR); |
148 | #endif | 154 | #endif |
155 | } | ||
149 | } | 156 | } |
150 | 157 | ||
151 | static const char* const fmtstr[] = | 158 | static const char* const fmtstr[] = |
152 | { | 159 | { |
153 | "%d %s", /* no decimals */ | 160 | "%c%d %s", /* no decimals */ |
154 | "%d.%d %s ", /* 1 decimal */ | 161 | "%c%d.%d %s ", /* 1 decimal */ |
155 | "%d.%02d %s " /* 2 decimals */ | 162 | "%c%d.%02d %s " /* 2 decimals */ |
156 | }; | 163 | }; |
157 | 164 | ||
158 | char *fmt_gain(int snd, int val, char *str, int len) | 165 | char *fmt_gain(int snd, int val, char *str, int len) |
159 | { | 166 | { |
160 | int tmp, i, d, numdec; | 167 | int i, d, numdec; |
161 | const char *unit; | 168 | const char *unit; |
162 | 169 | ||
163 | tmp = sound_val2phys(snd, val); | 170 | val = sound_val2phys(snd, val); |
171 | char sign = ' '; | ||
172 | if(val < 0) | ||
173 | { | ||
174 | sign = '-'; | ||
175 | val = abs(val); | ||
176 | } | ||
164 | numdec = sound_numdecimals(snd); | 177 | numdec = sound_numdecimals(snd); |
165 | unit = sound_unit(snd); | 178 | unit = sound_unit(snd); |
166 | 179 | ||
167 | if(numdec) | 180 | if(numdec) |
168 | { | 181 | { |
169 | i = tmp / (10*numdec); | 182 | i = val / (10*numdec); |
170 | d = abs(tmp % (10*numdec)); | 183 | d = val % (10*numdec); |
171 | snprintf(str, len, fmtstr[numdec], i, d, unit); | 184 | snprintf(str, len, fmtstr[numdec], sign, i, d, unit); |
172 | } | 185 | } |
173 | else | 186 | else |
174 | snprintf(str, len, fmtstr[numdec], tmp, unit); | 187 | snprintf(str, len, fmtstr[numdec], sign, val, unit); |
188 | |||
189 | return str; | ||
190 | } | ||
191 | |||
192 | char *fmt_gain2(int snd1, int val1, int snd2, int val2, char *str, int len) | ||
193 | { | ||
194 | /* same as above but for combined (added) values (recording gain) */ | ||
195 | int i, d, numdec; | ||
196 | const char *unit; | ||
197 | |||
198 | int val = sound_val2phys(snd1, val1) + sound_val2phys(snd2, val2); | ||
199 | char sign = ' '; | ||
200 | if(val < 0) | ||
201 | { | ||
202 | sign = '-'; | ||
203 | val = abs(val); | ||
204 | } | ||
205 | numdec = MAX(sound_numdecimals(snd1), sound_numdecimals(snd2)); | ||
206 | unit = sound_unit(snd1); /* should be same! */ | ||
207 | |||
208 | if(numdec) | ||
209 | { | ||
210 | i = val / (10*numdec); | ||
211 | d = val % (10*numdec); | ||
212 | snprintf(str, len, fmtstr[numdec], sign, i, d, unit); | ||
213 | } | ||
214 | else | ||
215 | snprintf(str, len, fmtstr[numdec], sign, val, unit); | ||
175 | 216 | ||
176 | return str; | 217 | return str; |
177 | } | 218 | } |
@@ -190,7 +231,6 @@ void adjust_cursor(void) | |||
190 | case SOURCE_MIC: | 231 | case SOURCE_MIC: |
191 | max_cursor = 1; | 232 | max_cursor = 1; |
192 | break; | 233 | break; |
193 | |||
194 | case SOURCE_LINE: | 234 | case SOURCE_LINE: |
195 | max_cursor = 3; | 235 | max_cursor = 3; |
196 | break; | 236 | break; |
@@ -198,7 +238,7 @@ void adjust_cursor(void) | |||
198 | max_cursor = 0; | 238 | max_cursor = 0; |
199 | break; | 239 | break; |
200 | } | 240 | } |
201 | 241 | ||
202 | if(cursor > max_cursor) | 242 | if(cursor > max_cursor) |
203 | cursor = max_cursor; | 243 | cursor = max_cursor; |
204 | } | 244 | } |
@@ -292,6 +332,158 @@ static void trigger_listener(int trigger_status) | |||
292 | } | 332 | } |
293 | } | 333 | } |
294 | 334 | ||
335 | #ifdef HAVE_UDA1380 | ||
336 | /* Handles combined recording gain changes. | ||
337 | GAIN RANGE = negative digital / analog / positive digital | ||
338 | */ | ||
339 | void change_recording_gain(bool increment, bool left, bool right, | ||
340 | int ana_mic_size, int ana_line_size) | ||
341 | { | ||
342 | if (increment) | ||
343 | { | ||
344 | if(global_settings.rec_source == SOURCE_MIC) | ||
345 | { | ||
346 | /* always changed as stereo */ | ||
347 | if(global_settings.rec_mic_decimator_left_gain < | ||
348 | sound_max(SOUND_DECIMATOR_LEFT_GAIN)) | ||
349 | { | ||
350 | /* increase digital gain by 1 if below max */ | ||
351 | global_settings.rec_mic_decimator_left_gain++; | ||
352 | global_settings.rec_mic_decimator_right_gain = | ||
353 | global_settings.rec_mic_decimator_left_gain; | ||
354 | } | ||
355 | |||
356 | /* mono increase */ | ||
357 | if((global_settings.rec_mic_decimator_left_gain >= ana_mic_size) && | ||
358 | (global_settings.rec_mic_gain < sound_max(SOUND_MIC_GAIN))) | ||
359 | { | ||
360 | /* in analogue range, cycle digital gain for each analogue */ | ||
361 | global_settings.rec_mic_decimator_left_gain = 0; | ||
362 | global_settings.rec_mic_decimator_right_gain = | ||
363 | global_settings.rec_mic_decimator_left_gain; | ||
364 | global_settings.rec_mic_gain++; | ||
365 | } | ||
366 | } | ||
367 | else | ||
368 | { | ||
369 | if(((left) && (right)) && | ||
370 | (global_settings.rec_linein_decimator_left_gain < | ||
371 | sound_max(SOUND_DECIMATOR_LEFT_GAIN)) && | ||
372 | (global_settings.rec_linein_decimator_right_gain < | ||
373 | sound_max(SOUND_DECIMATOR_RIGHT_GAIN)) ) | ||
374 | { | ||
375 | /* increase digital gain by 1 if below max*/ | ||
376 | global_settings.rec_linein_decimator_left_gain++; | ||
377 | global_settings.rec_linein_decimator_right_gain++; | ||
378 | } | ||
379 | else if((right) && (!left) && | ||
380 | (global_settings.rec_linein_decimator_right_gain < | ||
381 | sound_max(SOUND_DECIMATOR_RIGHT_GAIN))) | ||
382 | { | ||
383 | global_settings.rec_linein_decimator_right_gain++; | ||
384 | } | ||
385 | else if((left) && (!right) && | ||
386 | (global_settings.rec_linein_decimator_left_gain < | ||
387 | sound_max(SOUND_DECIMATOR_LEFT_GAIN))) | ||
388 | { | ||
389 | global_settings.rec_linein_decimator_left_gain++; | ||
390 | } | ||
391 | |||
392 | /* Stereo increase */ | ||
393 | if((left) && | ||
394 | (global_settings.rec_linein_decimator_left_gain >= | ||
395 | ana_line_size) && | ||
396 | (global_settings.rec_left_gain < sound_max(SOUND_LEFT_GAIN))) | ||
397 | { | ||
398 | /* if analogue range cycle left digital gain for each */ | ||
399 | global_settings.rec_linein_decimator_left_gain = 0; | ||
400 | global_settings.rec_left_gain++; | ||
401 | } | ||
402 | if((right) && | ||
403 | (global_settings.rec_linein_decimator_right_gain >= | ||
404 | ana_line_size) && | ||
405 | (global_settings.rec_right_gain < sound_max(SOUND_RIGHT_GAIN))) | ||
406 | { | ||
407 | /* if analogue range cycle right digital for each */ | ||
408 | global_settings.rec_linein_decimator_right_gain = 0; | ||
409 | global_settings.rec_right_gain++; | ||
410 | } | ||
411 | } | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | if(global_settings.rec_source == SOURCE_MIC) | ||
416 | { | ||
417 | /* always changed as stereo */ | ||
418 | if(global_settings.rec_mic_decimator_left_gain > | ||
419 | sound_min(SOUND_DECIMATOR_LEFT_GAIN)) | ||
420 | { | ||
421 | /* decrease digital gain by 1 if above minimum */ | ||
422 | global_settings.rec_mic_decimator_left_gain--; | ||
423 | global_settings.rec_mic_decimator_right_gain = | ||
424 | global_settings.rec_mic_decimator_left_gain; | ||
425 | } | ||
426 | |||
427 | /* mono decrease */ | ||
428 | if((global_settings.rec_mic_decimator_left_gain < 0) && | ||
429 | (global_settings.rec_mic_gain > sound_min(SOUND_MIC_GAIN))) | ||
430 | { | ||
431 | /* if analogue in range, cycle digital gain for each */ | ||
432 | global_settings.rec_mic_decimator_left_gain = ana_mic_size - 1; | ||
433 | global_settings.rec_mic_decimator_right_gain = | ||
434 | global_settings.rec_mic_decimator_left_gain; | ||
435 | global_settings.rec_mic_gain--; | ||
436 | } | ||
437 | } | ||
438 | else | ||
439 | { | ||
440 | if( ((left) && (right)) && | ||
441 | (global_settings.rec_linein_decimator_left_gain > | ||
442 | sound_min(SOUND_DECIMATOR_LEFT_GAIN)) && | ||
443 | (global_settings.rec_linein_decimator_right_gain > | ||
444 | sound_min(SOUND_DECIMATOR_RIGHT_GAIN)) ) | ||
445 | { | ||
446 | /* decrease digital gain by 1 if above minimum */ | ||
447 | global_settings.rec_linein_decimator_left_gain--; | ||
448 | global_settings.rec_linein_decimator_right_gain--; | ||
449 | } | ||
450 | else if((right) && (!left) && | ||
451 | (global_settings.rec_linein_decimator_right_gain > | ||
452 | sound_min(SOUND_DECIMATOR_RIGHT_GAIN))) | ||
453 | { | ||
454 | global_settings.rec_linein_decimator_right_gain--; | ||
455 | } | ||
456 | else if((left) && (!right) && | ||
457 | (global_settings.rec_linein_decimator_left_gain > | ||
458 | sound_min(SOUND_DECIMATOR_LEFT_GAIN))) | ||
459 | { | ||
460 | global_settings.rec_linein_decimator_left_gain--; | ||
461 | } | ||
462 | |||
463 | /* Stereo decrease */ | ||
464 | if((left) && | ||
465 | (global_settings.rec_linein_decimator_left_gain < 0) && | ||
466 | (global_settings.rec_left_gain > sound_min(SOUND_LEFT_GAIN))) | ||
467 | { | ||
468 | /* if in analogue range cycle left digital gain for each */ | ||
469 | global_settings.rec_left_gain--; | ||
470 | global_settings.rec_linein_decimator_left_gain = | ||
471 | ana_line_size - 1; | ||
472 | } | ||
473 | if((right) && | ||
474 | (global_settings.rec_linein_decimator_right_gain < 0) && | ||
475 | (global_settings.rec_right_gain > sound_min(SOUND_RIGHT_GAIN))) | ||
476 | { | ||
477 | /* if in analogue range cycle right digital gain for each */ | ||
478 | global_settings.rec_right_gain--; | ||
479 | global_settings.rec_linein_decimator_right_gain = | ||
480 | ana_line_size - 1; | ||
481 | } | ||
482 | } | ||
483 | } | ||
484 | } | ||
485 | #endif /* UDA1380 */ | ||
486 | |||
295 | bool recording_screen(void) | 487 | bool recording_screen(void) |
296 | { | 488 | { |
297 | long button; | 489 | long button; |
@@ -299,7 +491,6 @@ bool recording_screen(void) | |||
299 | bool done = false; | 491 | bool done = false; |
300 | char buf[32]; | 492 | char buf[32]; |
301 | char buf2[32]; | 493 | char buf2[32]; |
302 | int gain; | ||
303 | int w, h; | 494 | int w, h; |
304 | int update_countdown = 1; | 495 | int update_countdown = 1; |
305 | bool have_recorded = false; | 496 | bool have_recorded = false; |
@@ -314,6 +505,22 @@ bool recording_screen(void) | |||
314 | int led_countdown = 2; | 505 | int led_countdown = 2; |
315 | #endif | 506 | #endif |
316 | 507 | ||
508 | #ifdef HAVE_UDA1380 | ||
509 | /*calculate no. of digital steps to each analogue step. Assuming | ||
510 | left dig step = right dig step, and there is an integer no. of digital steps | ||
511 | in each analogue*/ | ||
512 | int ana_mic_size = sound_val2phys(SOUND_MIC_GAIN, 1) / | ||
513 | sound_val2phys(SOUND_DECIMATOR_LEFT_GAIN, 1); | ||
514 | int ana_line_size = sound_val2phys(SOUND_LEFT_GAIN, 1) / | ||
515 | sound_val2phys(SOUND_DECIMATOR_LEFT_GAIN, 1); | ||
516 | |||
517 | if(global_settings.rec_source == SOURCE_MIC) | ||
518 | { | ||
519 | global_settings.rec_mic_decimator_left_gain = | ||
520 | global_settings.rec_mic_decimator_right_gain; | ||
521 | } | ||
522 | #endif | ||
523 | |||
317 | const unsigned char *byte_units[] = { | 524 | const unsigned char *byte_units[] = { |
318 | ID2P(LANG_BYTE), | 525 | ID2P(LANG_BYTE), |
319 | ID2P(LANG_KILOBYTE), | 526 | ID2P(LANG_KILOBYTE), |
@@ -516,7 +723,7 @@ bool recording_screen(void) | |||
516 | update_countdown = 1; /* Update immediately */ | 723 | update_countdown = 1; /* Update immediately */ |
517 | break; | 724 | break; |
518 | #endif | 725 | #endif |
519 | 726 | ||
520 | case REC_INC: | 727 | case REC_INC: |
521 | case REC_INC | BUTTON_REPEAT: | 728 | case REC_INC | BUTTON_REPEAT: |
522 | switch(cursor) | 729 | switch(cursor) |
@@ -527,7 +734,20 @@ bool recording_screen(void) | |||
527 | global_settings.volume++; | 734 | global_settings.volume++; |
528 | sound_set_volume(global_settings.volume); | 735 | sound_set_volume(global_settings.volume); |
529 | break; | 736 | break; |
530 | 737 | #ifdef HAVE_UDA1380 | |
738 | case 1: | ||
739 | change_recording_gain(true, true, true, | ||
740 | ana_mic_size, ana_line_size); | ||
741 | break; | ||
742 | case 2: | ||
743 | change_recording_gain(true, true, false, | ||
744 | ana_mic_size, ana_line_size); | ||
745 | break; | ||
746 | case 3: | ||
747 | change_recording_gain(true, false, true, | ||
748 | ana_mic_size, ana_line_size); | ||
749 | break; | ||
750 | #else | ||
531 | case 1: | 751 | case 1: |
532 | if(global_settings.rec_source == SOURCE_MIC) | 752 | if(global_settings.rec_source == SOURCE_MIC) |
533 | { | 753 | { |
@@ -537,12 +757,12 @@ bool recording_screen(void) | |||
537 | } | 757 | } |
538 | else | 758 | else |
539 | { | 759 | { |
540 | gain = MAX(global_settings.rec_left_gain, | 760 | if(global_settings.rec_left_gain < |
541 | global_settings.rec_right_gain); | 761 | sound_max(SOUND_LEFT_GAIN)) |
542 | if(gain < sound_max(SOUND_LEFT_GAIN)) | 762 | global_settings.rec_left_gain++; |
543 | gain++; | 763 | if(global_settings.rec_right_gain < |
544 | global_settings.rec_left_gain = gain; | 764 | sound_max(SOUND_RIGHT_GAIN)) |
545 | global_settings.rec_right_gain = gain; | 765 | global_settings.rec_right_gain++; |
546 | } | 766 | } |
547 | break; | 767 | break; |
548 | case 2: | 768 | case 2: |
@@ -555,6 +775,7 @@ bool recording_screen(void) | |||
555 | sound_max(SOUND_RIGHT_GAIN)) | 775 | sound_max(SOUND_RIGHT_GAIN)) |
556 | global_settings.rec_right_gain++; | 776 | global_settings.rec_right_gain++; |
557 | break; | 777 | break; |
778 | #endif | ||
558 | } | 779 | } |
559 | set_gain(); | 780 | set_gain(); |
560 | update_countdown = 1; /* Update immediately */ | 781 | update_countdown = 1; /* Update immediately */ |
@@ -570,7 +791,23 @@ bool recording_screen(void) | |||
570 | global_settings.volume--; | 791 | global_settings.volume--; |
571 | sound_set_volume(global_settings.volume); | 792 | sound_set_volume(global_settings.volume); |
572 | break; | 793 | break; |
573 | 794 | #ifdef HAVE_UDA1380 | |
795 | case 1: | ||
796 | /* both channels */ | ||
797 | change_recording_gain(false, true, true, | ||
798 | ana_mic_size, ana_line_size); | ||
799 | break; | ||
800 | case 2: | ||
801 | /* only left */ | ||
802 | change_recording_gain(false, true, false, | ||
803 | ana_mic_size, ana_line_size); | ||
804 | break; | ||
805 | case 3: | ||
806 | /* only right */ | ||
807 | change_recording_gain(false, false, true, | ||
808 | ana_mic_size, ana_line_size); | ||
809 | break; | ||
810 | #else | ||
574 | case 1: | 811 | case 1: |
575 | if(global_settings.rec_source == SOURCE_MIC) | 812 | if(global_settings.rec_source == SOURCE_MIC) |
576 | { | 813 | { |
@@ -580,12 +817,12 @@ bool recording_screen(void) | |||
580 | } | 817 | } |
581 | else | 818 | else |
582 | { | 819 | { |
583 | gain = MAX(global_settings.rec_left_gain, | 820 | if(global_settings.rec_left_gain > |
584 | global_settings.rec_right_gain); | 821 | sound_min(SOUND_LEFT_GAIN)) |
585 | if(gain > sound_min(SOUND_LEFT_GAIN)) | 822 | global_settings.rec_left_gain--; |
586 | gain--; | 823 | if(global_settings.rec_right_gain > |
587 | global_settings.rec_left_gain = gain; | 824 | sound_min(SOUND_RIGHT_GAIN)) |
588 | global_settings.rec_right_gain = gain; | 825 | global_settings.rec_right_gain--; |
589 | } | 826 | } |
590 | break; | 827 | break; |
591 | case 2: | 828 | case 2: |
@@ -598,6 +835,7 @@ bool recording_screen(void) | |||
598 | sound_min(SOUND_RIGHT_GAIN)) | 835 | sound_min(SOUND_RIGHT_GAIN)) |
599 | global_settings.rec_right_gain--; | 836 | global_settings.rec_right_gain--; |
600 | break; | 837 | break; |
838 | #endif | ||
601 | } | 839 | } |
602 | set_gain(); | 840 | set_gain(); |
603 | update_countdown = 1; /* Update immediately */ | 841 | update_countdown = 1; /* Update immediately */ |
@@ -777,64 +1015,149 @@ bool recording_screen(void) | |||
777 | lcd_puts_style(0, 3, buf, STYLE_INVERT); | 1015 | lcd_puts_style(0, 3, buf, STYLE_INVERT); |
778 | else | 1016 | else |
779 | lcd_puts(0, 3, buf); | 1017 | lcd_puts(0, 3, buf); |
1018 | |||
780 | 1019 | ||
781 | if(global_settings.rec_source == SOURCE_MIC) | 1020 | if(global_settings.rec_source == SOURCE_MIC) |
782 | { | 1021 | { |
783 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), | 1022 | #ifdef HAVE_UDA1380 |
1023 | |||
1024 | /*****************test info code*********************** | ||
1025 | snprintf(buf, 32, "Aa:(2x) %d DigL:(0.5x) %d ", | ||
1026 | global_settings.rec_mic_gain, | ||
1027 | global_settings.rec_mic_decimator_left_gain); | ||
1028 | lcd_puts(0, 10, buf); | ||
1029 | snprintf(buf, 32, "DigR:(0.5x) %d", | ||
1030 | global_settings.rec_mic_decimator_right_gain); | ||
1031 | lcd_puts(9, 12, buf); | ||
1032 | *****************test info code***********************/ | ||
1033 | |||
1034 | snprintf(buf, 32, "%s:%s (%s)", | ||
1035 | str(LANG_RECORDING_GAIN), | ||
1036 | fmt_gain2(SOUND_MIC_GAIN, | ||
1037 | global_settings.rec_mic_gain, | ||
1038 | SOUND_DECIMATOR_LEFT_GAIN, | ||
1039 | global_settings.rec_mic_decimator_left_gain, | ||
1040 | buf2, sizeof(buf2)), | ||
1041 | (((global_settings.rec_mic_gain == | ||
1042 | sound_max(SOUND_MIC_GAIN)) && | ||
1043 | (global_settings.rec_mic_decimator_left_gain > 0))|| | ||
1044 | ((global_settings.rec_mic_gain == | ||
1045 | sound_min(SOUND_MIC_GAIN)) && | ||
1046 | (global_settings.rec_mic_decimator_left_gain < 0)))? | ||
1047 | str(LANG_RECORDING_GAIN_DIGITAL) : | ||
1048 | str(LANG_RECORDING_GAIN_ANALOG) | ||
1049 | ); | ||
1050 | #else /* HAVE_UDA1380 */ | ||
1051 | snprintf(buf, 32, "%s:%s", str(LANG_RECORDING_GAIN), | ||
784 | fmt_gain(SOUND_MIC_GAIN, | 1052 | fmt_gain(SOUND_MIC_GAIN, |
785 | global_settings.rec_mic_gain, | 1053 | global_settings.rec_mic_gain, |
786 | buf2, sizeof(buf2))); | 1054 | buf2, sizeof(buf2))); |
787 | if (global_settings.invert_cursor && (pos++ == cursor)) | 1055 | #endif |
1056 | if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) | ||
788 | lcd_puts_style(0, 4, buf, STYLE_INVERT); | 1057 | lcd_puts_style(0, 4, buf, STYLE_INVERT); |
789 | else | 1058 | else |
790 | lcd_puts(0, 4, buf); | 1059 | lcd_puts(0, 4, buf); |
791 | } | 1060 | } |
792 | else | 1061 | else if(global_settings.rec_source == SOURCE_LINE) |
793 | { | 1062 | { |
794 | if(global_settings.rec_source == SOURCE_LINE) | 1063 | #ifdef HAVE_UDA1380 |
795 | { | ||
796 | gain = MAX(global_settings.rec_left_gain, | ||
797 | global_settings.rec_right_gain); | ||
798 | |||
799 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), | ||
800 | fmt_gain(SOUND_LEFT_GAIN, gain, | ||
801 | buf2, sizeof(buf2))); | ||
802 | if (global_settings.invert_cursor && (pos++ == cursor)) | ||
803 | lcd_puts_style(0, 4, buf, STYLE_INVERT); | ||
804 | else | ||
805 | lcd_puts(0, 4, buf); | ||
806 | |||
807 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_LEFT), | ||
808 | fmt_gain(SOUND_LEFT_GAIN, | ||
809 | global_settings.rec_left_gain, | ||
810 | buf2, sizeof(buf2))); | ||
811 | if (global_settings.invert_cursor && (pos++ == cursor)) | ||
812 | lcd_puts_style(0, 5, buf, STYLE_INVERT); | ||
813 | else | ||
814 | lcd_puts(0, 5, buf); | ||
815 | |||
816 | snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_RIGHT), | ||
817 | fmt_gain(SOUND_RIGHT_GAIN, | ||
818 | global_settings.rec_right_gain, | ||
819 | buf2, sizeof(buf2))); | ||
820 | if (global_settings.invert_cursor && (pos == cursor)) | ||
821 | lcd_puts_style(0, 6, buf, STYLE_INVERT); | ||
822 | else | ||
823 | lcd_puts(0, 6, buf); | ||
824 | } | ||
825 | } | ||
826 | 1064 | ||
827 | put_cursorxy(0, 3 + cursor, true); | 1065 | /*****************test info code*********************** |
828 | 1066 | snprintf(buf, 32, "AL:(3x) %d DigL:(0.5x) %d", | |
829 | if (global_settings.rec_source != SOURCE_LINE) { | 1067 | global_settings.rec_left_gain, |
830 | snprintf(buf, 32, "%s %s [%d]", | 1068 | global_settings.rec_linein_decimator_left_gain); |
831 | freq_str[global_settings.rec_frequency], | 1069 | lcd_puts(0, 10, buf); |
832 | global_settings.rec_channels? | 1070 | snprintf(buf, 32, "AR:(3x) %d DigR:(0.5x) %d", |
833 | str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO), | 1071 | global_settings.rec_right_gain, |
834 | global_settings.rec_quality); | 1072 | global_settings.rec_linein_decimator_right_gain); |
835 | lcd_puts(0, 6, buf); | 1073 | lcd_puts(0, 12, buf); |
1074 | *****************test info code***********************/ | ||
1075 | |||
1076 | snprintf(buf, 32, "%s:%s (%s)", | ||
1077 | str(LANG_RECORDING_LEFT), | ||
1078 | fmt_gain2(SOUND_LEFT_GAIN, | ||
1079 | global_settings.rec_left_gain, | ||
1080 | SOUND_DECIMATOR_LEFT_GAIN, | ||
1081 | global_settings.rec_linein_decimator_left_gain, | ||
1082 | buf2, sizeof(buf2)), | ||
1083 | (((global_settings.rec_left_gain == | ||
1084 | sound_max(SOUND_LEFT_GAIN)) && | ||
1085 | (global_settings.rec_linein_decimator_left_gain | ||
1086 | > 0)) || | ||
1087 | ((global_settings.rec_left_gain == | ||
1088 | sound_min(SOUND_LEFT_GAIN)) && | ||
1089 | (global_settings.rec_linein_decimator_left_gain | ||
1090 | < 0))) ? | ||
1091 | str(LANG_RECORDING_GAIN_DIGITAL) : | ||
1092 | str(LANG_RECORDING_GAIN_ANALOG) | ||
1093 | ); | ||
1094 | #else /* HAVE_UDA1380 */ | ||
1095 | snprintf(buf, 32, "%s:%s", | ||
1096 | str(LANG_RECORDING_LEFT), | ||
1097 | fmt_gain(SOUND_LEFT_GAIN, | ||
1098 | global_settings.rec_left_gain, | ||
1099 | buf2, sizeof(buf2))); | ||
1100 | #endif /* HAVE_UDA1380 */ | ||
1101 | if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) | ||
1102 | lcd_puts_style(0, 4, buf, STYLE_INVERT); | ||
1103 | else | ||
1104 | lcd_puts(0, 4, buf); | ||
1105 | #ifdef HAVE_UDA1380 | ||
1106 | snprintf(buf, 32, "%s:%s (%s)", | ||
1107 | str(LANG_RECORDING_RIGHT), | ||
1108 | fmt_gain2(SOUND_RIGHT_GAIN, | ||
1109 | global_settings.rec_right_gain, | ||
1110 | SOUND_DECIMATOR_RIGHT_GAIN, | ||
1111 | global_settings.rec_linein_decimator_right_gain, | ||
1112 | buf2, sizeof(buf2)), | ||
1113 | (((global_settings.rec_right_gain == | ||
1114 | sound_max(SOUND_RIGHT_GAIN)) && | ||
1115 | (global_settings.rec_linein_decimator_right_gain | ||
1116 | > 0)) || | ||
1117 | ((global_settings.rec_right_gain == | ||
1118 | sound_min(SOUND_RIGHT_GAIN)) && | ||
1119 | (global_settings.rec_linein_decimator_right_gain | ||
1120 | < 0))) ? | ||
1121 | str(LANG_RECORDING_GAIN_DIGITAL) : | ||
1122 | str(LANG_RECORDING_GAIN_ANALOG) | ||
1123 | ); | ||
1124 | #else /* HAVE_UDA1380 */ | ||
1125 | snprintf(buf, 32, "%s:%s", | ||
1126 | str(LANG_RECORDING_RIGHT), | ||
1127 | fmt_gain(SOUND_RIGHT_GAIN, | ||
1128 | global_settings.rec_right_gain, | ||
1129 | buf2, sizeof(buf2))); | ||
1130 | #endif /* HAVE_UDA1380 */ | ||
1131 | if(global_settings.invert_cursor && ((1==cursor)||(3==cursor))) | ||
1132 | lcd_puts_style(0, 5, buf, STYLE_INVERT); | ||
1133 | else | ||
1134 | lcd_puts(0, 5, buf); | ||
1135 | } | ||
1136 | switch(cursor) | ||
1137 | { | ||
1138 | case 1: | ||
1139 | put_cursorxy(0, 4, true); | ||
1140 | |||
1141 | if(global_settings.rec_source != SOURCE_MIC) | ||
1142 | put_cursorxy(0, 5, true); | ||
1143 | |||
1144 | break; | ||
1145 | case 2: | ||
1146 | put_cursorxy(0, 4, true); | ||
1147 | break; | ||
1148 | case 3: | ||
1149 | put_cursorxy(0, 5, true); | ||
1150 | break; | ||
1151 | default: | ||
1152 | put_cursorxy(0, 0, true); | ||
836 | } | 1153 | } |
837 | 1154 | ||
1155 | snprintf(buf, 32, "%s %s", | ||
1156 | freq_str[global_settings.rec_frequency], | ||
1157 | global_settings.rec_channels? | ||
1158 | str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO)); | ||
1159 | lcd_puts(0, 7, buf); | ||
1160 | |||
838 | gui_syncstatusbar_draw(&statusbars, true); | 1161 | gui_syncstatusbar_draw(&statusbars, true); |
839 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); | 1162 | peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); |
840 | 1163 | ||