summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/recorder/radio.c6
-rw-r--r--apps/recorder/recording.c331
-rw-r--r--apps/settings.c180
-rw-r--r--apps/settings.h6
-rw-r--r--firmware/drivers/uda1380.c31
-rw-r--r--firmware/export/audio.h1
-rw-r--r--firmware/export/sound.h4
-rw-r--r--firmware/pcm_record.c3
-rw-r--r--firmware/sound.c20
9 files changed, 107 insertions, 475 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 0976a57467..291079b4b0 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -385,18 +385,16 @@ bool radio_screen(void)
385 global_settings.rec_prerecord_time); 385 global_settings.rec_prerecord_time);
386 386
387 387
388 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
389 sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
390#else 388#else
391 peak_meter_enabled = false; 389 peak_meter_enabled = false;
392 uda1380_enable_recording(false); 390 uda1380_enable_recording(false);
393 uda1380_set_recvol(10, 10, AUDIO_GAIN_DECIMATOR);
394 uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN);
395 uda1380_set_monitor(true); 391 uda1380_set_monitor(true);
396 392
397 /* Set the input multiplexer to FM */ 393 /* Set the input multiplexer to FM */
398 pcm_rec_mux(1); 394 pcm_rec_mux(1);
399#endif 395#endif
396 audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
397 sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
400#endif 398#endif
401 399
402 curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ; 400 curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ;
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index f6ce9bc872..cdbc170b03 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -155,22 +155,12 @@ static void set_gain(void)
155 { 155 {
156 audio_set_recording_gain(global_settings.rec_mic_gain, 156 audio_set_recording_gain(global_settings.rec_mic_gain,
157 0, AUDIO_GAIN_MIC); 157 0, AUDIO_GAIN_MIC);
158#ifdef HAVE_UDA1380
159 audio_set_recording_gain(global_settings.rec_mic_decimator_left_gain,
160 global_settings.rec_mic_decimator_right_gain,
161 AUDIO_GAIN_DECIMATOR);
162#endif
163 } 158 }
164 else 159 else
165 { 160 {
166 audio_set_recording_gain(global_settings.rec_left_gain, 161 audio_set_recording_gain(global_settings.rec_left_gain,
167 global_settings.rec_right_gain, 162 global_settings.rec_right_gain,
168 AUDIO_GAIN_LINEIN); 163 AUDIO_GAIN_LINEIN);
169#ifdef HAVE_UDA1380
170 audio_set_recording_gain(global_settings.rec_linein_decimator_left_gain,
171 global_settings.rec_linein_decimator_right_gain,
172 AUDIO_GAIN_DECIMATOR);
173#endif
174 } 164 }
175} 165}
176 166
@@ -185,13 +175,13 @@ char *fmt_gain(int snd, int val, char *str, int len)
185{ 175{
186 int i, d, numdec; 176 int i, d, numdec;
187 const char *unit; 177 const char *unit;
178 char sign = ' ';
188 179
189 val = sound_val2phys(snd, val); 180 val = sound_val2phys(snd, val);
190 char sign = ' ';
191 if(val < 0) 181 if(val < 0)
192 { 182 {
193 sign = '-'; 183 sign = '-';
194 val = abs(val); 184 val = -val;
195 } 185 }
196 numdec = sound_numdecimals(snd); 186 numdec = sound_numdecimals(snd);
197 unit = sound_unit(snd); 187 unit = sound_unit(snd);
@@ -208,34 +198,6 @@ char *fmt_gain(int snd, int val, char *str, int len)
208 return str; 198 return str;
209} 199}
210 200
211char *fmt_gain2(int snd1, int val1, int snd2, int val2, char *str, int len)
212{
213 /* same as above but for combined (added) values (recording gain) */
214 int i, d, numdec;
215 const char *unit;
216
217 int val = sound_val2phys(snd1, val1) + sound_val2phys(snd2, val2);
218 char sign = ' ';
219 if(val < 0)
220 {
221 sign = '-';
222 val = abs(val);
223 }
224 numdec = MAX(sound_numdecimals(snd1), sound_numdecimals(snd2));
225 unit = sound_unit(snd1); /* should be same! */
226
227 if(numdec)
228 {
229 i = val / (10*numdec);
230 d = val % (10*numdec);
231 snprintf(str, len, fmtstr[numdec], sign, i, d, unit);
232 }
233 else
234 snprintf(str, len, fmtstr[numdec], sign, val, unit);
235
236 return str;
237}
238
239static int cursor; 201static int cursor;
240 202
241void adjust_cursor(void) 203void adjust_cursor(void)
@@ -351,158 +313,6 @@ static void trigger_listener(int trigger_status)
351 } 313 }
352} 314}
353 315
354#ifdef HAVE_UDA1380
355/* Handles combined recording gain changes.
356 GAIN RANGE = negative digital / analog / positive digital
357 */
358void change_recording_gain(bool increment, bool left, bool right,
359 int ana_mic_size, int ana_line_size)
360{
361 if (increment)
362 {
363 if(global_settings.rec_source == SOURCE_MIC)
364 {
365 /* always changed as stereo */
366 if(global_settings.rec_mic_decimator_left_gain <
367 sound_max(SOUND_DECIMATOR_LEFT_GAIN))
368 {
369 /* increase digital gain by 1 if below max */
370 global_settings.rec_mic_decimator_left_gain++;
371 global_settings.rec_mic_decimator_right_gain =
372 global_settings.rec_mic_decimator_left_gain;
373 }
374
375 /* mono increase */
376 if((global_settings.rec_mic_decimator_left_gain >= ana_mic_size) &&
377 (global_settings.rec_mic_gain < sound_max(SOUND_MIC_GAIN)))
378 {
379 /* in analogue range, cycle digital gain for each analogue */
380 global_settings.rec_mic_decimator_left_gain = 0;
381 global_settings.rec_mic_decimator_right_gain =
382 global_settings.rec_mic_decimator_left_gain;
383 global_settings.rec_mic_gain++;
384 }
385 }
386 else
387 {
388 if(((left) && (right)) &&
389 (global_settings.rec_linein_decimator_left_gain <
390 sound_max(SOUND_DECIMATOR_LEFT_GAIN)) &&
391 (global_settings.rec_linein_decimator_right_gain <
392 sound_max(SOUND_DECIMATOR_RIGHT_GAIN)) )
393 {
394 /* increase digital gain by 1 if below max*/
395 global_settings.rec_linein_decimator_left_gain++;
396 global_settings.rec_linein_decimator_right_gain++;
397 }
398 else if((right) && (!left) &&
399 (global_settings.rec_linein_decimator_right_gain <
400 sound_max(SOUND_DECIMATOR_RIGHT_GAIN)))
401 {
402 global_settings.rec_linein_decimator_right_gain++;
403 }
404 else if((left) && (!right) &&
405 (global_settings.rec_linein_decimator_left_gain <
406 sound_max(SOUND_DECIMATOR_LEFT_GAIN)))
407 {
408 global_settings.rec_linein_decimator_left_gain++;
409 }
410
411 /* Stereo increase */
412 if((left) &&
413 (global_settings.rec_linein_decimator_left_gain >=
414 ana_line_size) &&
415 (global_settings.rec_left_gain < sound_max(SOUND_LEFT_GAIN)))
416 {
417 /* if analogue range cycle left digital gain for each */
418 global_settings.rec_linein_decimator_left_gain = 0;
419 global_settings.rec_left_gain++;
420 }
421 if((right) &&
422 (global_settings.rec_linein_decimator_right_gain >=
423 ana_line_size) &&
424 (global_settings.rec_right_gain < sound_max(SOUND_RIGHT_GAIN)))
425 {
426 /* if analogue range cycle right digital for each */
427 global_settings.rec_linein_decimator_right_gain = 0;
428 global_settings.rec_right_gain++;
429 }
430 }
431 }
432 else
433 {
434 if(global_settings.rec_source == SOURCE_MIC)
435 {
436 /* always changed as stereo */
437 if(global_settings.rec_mic_decimator_left_gain >
438 sound_min(SOUND_DECIMATOR_LEFT_GAIN))
439 {
440 /* decrease digital gain by 1 if above minimum */
441 global_settings.rec_mic_decimator_left_gain--;
442 global_settings.rec_mic_decimator_right_gain =
443 global_settings.rec_mic_decimator_left_gain;
444 }
445
446 /* mono decrease */
447 if((global_settings.rec_mic_decimator_left_gain < 0) &&
448 (global_settings.rec_mic_gain > sound_min(SOUND_MIC_GAIN)))
449 {
450 /* if analogue in range, cycle digital gain for each */
451 global_settings.rec_mic_decimator_left_gain = ana_mic_size - 1;
452 global_settings.rec_mic_decimator_right_gain =
453 global_settings.rec_mic_decimator_left_gain;
454 global_settings.rec_mic_gain--;
455 }
456 }
457 else
458 {
459 if( ((left) && (right)) &&
460 (global_settings.rec_linein_decimator_left_gain >
461 sound_min(SOUND_DECIMATOR_LEFT_GAIN)) &&
462 (global_settings.rec_linein_decimator_right_gain >
463 sound_min(SOUND_DECIMATOR_RIGHT_GAIN)) )
464 {
465 /* decrease digital gain by 1 if above minimum */
466 global_settings.rec_linein_decimator_left_gain--;
467 global_settings.rec_linein_decimator_right_gain--;
468 }
469 else if((right) && (!left) &&
470 (global_settings.rec_linein_decimator_right_gain >
471 sound_min(SOUND_DECIMATOR_RIGHT_GAIN)))
472 {
473 global_settings.rec_linein_decimator_right_gain--;
474 }
475 else if((left) && (!right) &&
476 (global_settings.rec_linein_decimator_left_gain >
477 sound_min(SOUND_DECIMATOR_LEFT_GAIN)))
478 {
479 global_settings.rec_linein_decimator_left_gain--;
480 }
481
482 /* Stereo decrease */
483 if((left) &&
484 (global_settings.rec_linein_decimator_left_gain < 0) &&
485 (global_settings.rec_left_gain > sound_min(SOUND_LEFT_GAIN)))
486 {
487 /* if in analogue range cycle left digital gain for each */
488 global_settings.rec_left_gain--;
489 global_settings.rec_linein_decimator_left_gain =
490 ana_line_size - 1;
491 }
492 if((right) &&
493 (global_settings.rec_linein_decimator_right_gain < 0) &&
494 (global_settings.rec_right_gain > sound_min(SOUND_RIGHT_GAIN)))
495 {
496 /* if in analogue range cycle right digital gain for each */
497 global_settings.rec_right_gain--;
498 global_settings.rec_linein_decimator_right_gain =
499 ana_line_size - 1;
500 }
501 }
502 }
503}
504#endif /* UDA1380 */
505
506bool recording_screen(void) 316bool recording_screen(void)
507{ 317{
508 long button; 318 long button;
@@ -525,22 +335,6 @@ bool recording_screen(void)
525#endif 335#endif
526 int i; 336 int i;
527 337
528#ifdef HAVE_UDA1380
529/*calculate no. of digital steps to each analogue step. Assuming
530 left dig step = right dig step, and there is an integer no. of digital steps
531 in each analogue*/
532 int ana_mic_size = sound_val2phys(SOUND_MIC_GAIN, 1) /
533 sound_val2phys(SOUND_DECIMATOR_LEFT_GAIN, 1);
534 int ana_line_size = sound_val2phys(SOUND_LEFT_GAIN, 1) /
535 sound_val2phys(SOUND_DECIMATOR_LEFT_GAIN, 1);
536
537 if(global_settings.rec_source == SOURCE_MIC)
538 {
539 global_settings.rec_mic_decimator_left_gain =
540 global_settings.rec_mic_decimator_right_gain;
541 }
542#endif
543
544 const unsigned char *byte_units[] = { 338 const unsigned char *byte_units[] = {
545 ID2P(LANG_BYTE), 339 ID2P(LANG_BYTE),
546 ID2P(LANG_KILOBYTE), 340 ID2P(LANG_KILOBYTE),
@@ -789,20 +583,6 @@ bool recording_screen(void)
789 global_settings.volume++; 583 global_settings.volume++;
790 sound_set_volume(global_settings.volume); 584 sound_set_volume(global_settings.volume);
791 break; 585 break;
792#ifdef HAVE_UDA1380
793 case 1:
794 change_recording_gain(true, true, true,
795 ana_mic_size, ana_line_size);
796 break;
797 case 2:
798 change_recording_gain(true, true, false,
799 ana_mic_size, ana_line_size);
800 break;
801 case 3:
802 change_recording_gain(true, false, true,
803 ana_mic_size, ana_line_size);
804 break;
805#else
806 case 1: 586 case 1:
807 if(global_settings.rec_source == SOURCE_MIC) 587 if(global_settings.rec_source == SOURCE_MIC)
808 { 588 {
@@ -830,7 +610,6 @@ bool recording_screen(void)
830 sound_max(SOUND_RIGHT_GAIN)) 610 sound_max(SOUND_RIGHT_GAIN))
831 global_settings.rec_right_gain++; 611 global_settings.rec_right_gain++;
832 break; 612 break;
833#endif
834 } 613 }
835 set_gain(); 614 set_gain();
836 update_countdown = 1; /* Update immediately */ 615 update_countdown = 1; /* Update immediately */
@@ -850,23 +629,6 @@ bool recording_screen(void)
850 global_settings.volume--; 629 global_settings.volume--;
851 sound_set_volume(global_settings.volume); 630 sound_set_volume(global_settings.volume);
852 break; 631 break;
853#ifdef HAVE_UDA1380
854 case 1:
855 /* both channels */
856 change_recording_gain(false, true, true,
857 ana_mic_size, ana_line_size);
858 break;
859 case 2:
860 /* only left */
861 change_recording_gain(false, true, false,
862 ana_mic_size, ana_line_size);
863 break;
864 case 3:
865 /* only right */
866 change_recording_gain(false, false, true,
867 ana_mic_size, ana_line_size);
868 break;
869#else
870 case 1: 632 case 1:
871 if(global_settings.rec_source == SOURCE_MIC) 633 if(global_settings.rec_source == SOURCE_MIC)
872 { 634 {
@@ -894,7 +656,6 @@ bool recording_screen(void)
894 sound_min(SOUND_RIGHT_GAIN)) 656 sound_min(SOUND_RIGHT_GAIN))
895 global_settings.rec_right_gain--; 657 global_settings.rec_right_gain--;
896 break; 658 break;
897#endif
898 } 659 }
899 set_gain(); 660 set_gain();
900 update_countdown = 1; /* Update immediately */ 661 update_countdown = 1; /* Update immediately */
@@ -1097,40 +858,10 @@ bool recording_screen(void)
1097 858
1098 if(global_settings.rec_source == SOURCE_MIC) 859 if(global_settings.rec_source == SOURCE_MIC)
1099 { 860 {
1100#ifdef HAVE_UDA1380
1101
1102 /*****************test info code***********************
1103 snprintf(buf, 32, "Aa:(2x) %d DigL:(0.5x) %d ",
1104 global_settings.rec_mic_gain,
1105 global_settings.rec_mic_decimator_left_gain);
1106 lcd_puts(0, 10, buf);
1107 snprintf(buf, 32, "DigR:(0.5x) %d",
1108 global_settings.rec_mic_decimator_right_gain);
1109 lcd_puts(9, 12, buf);
1110 *****************test info code***********************/
1111
1112 snprintf(buf, 32, "%s:%s (%s)",
1113 str(LANG_RECORDING_GAIN),
1114 fmt_gain2(SOUND_MIC_GAIN,
1115 global_settings.rec_mic_gain,
1116 SOUND_DECIMATOR_LEFT_GAIN,
1117 global_settings.rec_mic_decimator_left_gain,
1118 buf2, sizeof(buf2)),
1119 (((global_settings.rec_mic_gain ==
1120 sound_max(SOUND_MIC_GAIN)) &&
1121 (global_settings.rec_mic_decimator_left_gain > 0))||
1122 ((global_settings.rec_mic_gain ==
1123 sound_min(SOUND_MIC_GAIN)) &&
1124 (global_settings.rec_mic_decimator_left_gain < 0)))?
1125 str(LANG_RECORDING_GAIN_DIGITAL) :
1126 str(LANG_RECORDING_GAIN_ANALOG)
1127 );
1128#else /* HAVE_UDA1380 */
1129 snprintf(buf, 32, "%s:%s", str(LANG_RECORDING_GAIN), 861 snprintf(buf, 32, "%s:%s", str(LANG_RECORDING_GAIN),
1130 fmt_gain(SOUND_MIC_GAIN, 862 fmt_gain(SOUND_MIC_GAIN,
1131 global_settings.rec_mic_gain, 863 global_settings.rec_mic_gain,
1132 buf2, sizeof(buf2))); 864 buf2, sizeof(buf2)));
1133#endif
1134 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) 865 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor)))
1135 { 866 {
1136 FOR_NB_SCREENS(i) 867 FOR_NB_SCREENS(i)
@@ -1145,44 +876,11 @@ bool recording_screen(void)
1145 } 876 }
1146 else if(global_settings.rec_source == SOURCE_LINE) 877 else if(global_settings.rec_source == SOURCE_LINE)
1147 { 878 {
1148#ifdef HAVE_UDA1380
1149
1150 /*****************test info code***********************
1151 snprintf(buf, 32, "AL:(3x) %d DigL:(0.5x) %d",
1152 global_settings.rec_left_gain,
1153 global_settings.rec_linein_decimator_left_gain);
1154 lcd_puts(0, 10, buf);
1155 snprintf(buf, 32, "AR:(3x) %d DigR:(0.5x) %d",
1156 global_settings.rec_right_gain,
1157 global_settings.rec_linein_decimator_right_gain);
1158 lcd_puts(0, 12, buf);
1159 *****************test info code***********************/
1160
1161 snprintf(buf, 32, "%s:%s (%s)",
1162 str(LANG_RECORDING_LEFT),
1163 fmt_gain2(SOUND_LEFT_GAIN,
1164 global_settings.rec_left_gain,
1165 SOUND_DECIMATOR_LEFT_GAIN,
1166 global_settings.rec_linein_decimator_left_gain,
1167 buf2, sizeof(buf2)),
1168 (((global_settings.rec_left_gain ==
1169 sound_max(SOUND_LEFT_GAIN)) &&
1170 (global_settings.rec_linein_decimator_left_gain
1171 > 0)) ||
1172 ((global_settings.rec_left_gain ==
1173 sound_min(SOUND_LEFT_GAIN)) &&
1174 (global_settings.rec_linein_decimator_left_gain
1175 < 0))) ?
1176 str(LANG_RECORDING_GAIN_DIGITAL) :
1177 str(LANG_RECORDING_GAIN_ANALOG)
1178 );
1179#else /* HAVE_UDA1380 */
1180 snprintf(buf, 32, "%s:%s", 879 snprintf(buf, 32, "%s:%s",
1181 str(LANG_RECORDING_LEFT), 880 str(LANG_RECORDING_LEFT),
1182 fmt_gain(SOUND_LEFT_GAIN, 881 fmt_gain(SOUND_LEFT_GAIN,
1183 global_settings.rec_left_gain, 882 global_settings.rec_left_gain,
1184 buf2, sizeof(buf2))); 883 buf2, sizeof(buf2)));
1185#endif /* HAVE_UDA1380 */
1186 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) 884 if(global_settings.invert_cursor && ((1==cursor)||(2==cursor)))
1187 { 885 {
1188 FOR_NB_SCREENS(i) 886 FOR_NB_SCREENS(i)
@@ -1195,32 +893,11 @@ bool recording_screen(void)
1195 screens[i].puts(0, 3+PM_HEIGHT, buf); 893 screens[i].puts(0, 3+PM_HEIGHT, buf);
1196 } 894 }
1197 895
1198#ifdef HAVE_UDA1380
1199 snprintf(buf, 32, "%s:%s (%s)",
1200 str(LANG_RECORDING_RIGHT),
1201 fmt_gain2(SOUND_RIGHT_GAIN,
1202 global_settings.rec_right_gain,
1203 SOUND_DECIMATOR_RIGHT_GAIN,
1204 global_settings.rec_linein_decimator_right_gain,
1205 buf2, sizeof(buf2)),
1206 (((global_settings.rec_right_gain ==
1207 sound_max(SOUND_RIGHT_GAIN)) &&
1208 (global_settings.rec_linein_decimator_right_gain
1209 > 0)) ||
1210 ((global_settings.rec_right_gain ==
1211 sound_min(SOUND_RIGHT_GAIN)) &&
1212 (global_settings.rec_linein_decimator_right_gain
1213 < 0))) ?
1214 str(LANG_RECORDING_GAIN_DIGITAL) :
1215 str(LANG_RECORDING_GAIN_ANALOG)
1216 );
1217#else /* HAVE_UDA1380 */
1218 snprintf(buf, 32, "%s:%s", 896 snprintf(buf, 32, "%s:%s",
1219 str(LANG_RECORDING_RIGHT), 897 str(LANG_RECORDING_RIGHT),
1220 fmt_gain(SOUND_RIGHT_GAIN, 898 fmt_gain(SOUND_RIGHT_GAIN,
1221 global_settings.rec_right_gain, 899 global_settings.rec_right_gain,
1222 buf2, sizeof(buf2))); 900 buf2, sizeof(buf2)));
1223#endif /* HAVE_UDA1380 */
1224 if(global_settings.invert_cursor && ((1==cursor)||(3==cursor))) 901 if(global_settings.invert_cursor && ((1==cursor)||(3==cursor)))
1225 { 902 {
1226 FOR_NB_SCREENS(i) 903 FOR_NB_SCREENS(i)
@@ -1266,14 +943,14 @@ bool recording_screen(void)
1266 } 943 }
1267 } 944 }
1268/* Can't measure S/PDIF sample rate on Archos yet */ 945/* Can't measure S/PDIF sample rate on Archos yet */
1269#if CONFIG_CODEC != MAS3587F && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR) 946#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
1270 if (global_settings.rec_source == SOURCE_SPDIF) 947 if (global_settings.rec_source == SOURCE_SPDIF)
1271 snprintf(spdif_sfreq, 8, "%dHz", audio_get_spdif_sample_rate()); 948 snprintf(spdif_sfreq, 8, "%dHz", audio_get_spdif_sample_rate());
1272#else 949#else
1273 (void)spdif_sfreq; 950 (void)spdif_sfreq;
1274#endif 951#endif
1275 snprintf(buf, 32, "%s %s", 952 snprintf(buf, 32, "%s %s",
1276#if CONFIG_CODEC != MAS3587F && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR) 953#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
1277 global_settings.rec_source == SOURCE_SPDIF ? 954 global_settings.rec_source == SOURCE_SPDIF ?
1278 spdif_sfreq : 955 spdif_sfreq :
1279#endif 956#endif
diff --git a/apps/settings.c b/apps/settings.c
index ccf0acd8f9..0031130f9a 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
94#include "dsp.h" 94#include "dsp.h"
95#endif 95#endif
96 96
97#define CONFIG_BLOCK_VERSION 42 97#define CONFIG_BLOCK_VERSION 43
98#define CONFIG_BLOCK_SIZE 512 98#define CONFIG_BLOCK_SIZE 512
99#define RTC_BLOCK_SIZE 44 99#define RTC_BLOCK_SIZE 44
100 100
@@ -342,20 +342,47 @@ static const struct bit_entry hd_bits[] =
342#ifdef CONFIG_BACKLIGHT 342#ifdef CONFIG_BACKLIGHT
343 {1, S_O(caption_backlight), false, "caption backlight", off_on }, 343 {1, S_O(caption_backlight), false, "caption backlight", off_on },
344#endif 344#endif
345#ifdef HAVE_REMOTE_LCD
346 {1, S_O(remote_caption_backlight), false,
347 "remote caption backlight", off_on },
348#endif
349#ifdef HAVE_BACKLIGHT_BRIGHTNESS
350 {4, S_O(brightness), 9, "brightness", NULL },
351#endif
352#ifdef HAVE_BACKLIGHT_PWM_FADING
353 /* backlight fading */
354 {2, S_O(backlight_fade_in), 1, "backlight fade in", "off,500ms,1s,2s"},
355 {3, S_O(backlight_fade_out), 3, "backlight fade out",
356 "off,500ms,1s,2s,3s,4s,5s,10s"},
357#endif
358
345 {4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */ 359 {4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */
360 {8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */
361 {8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */
346#ifdef HAVE_LCD_BITMAP 362#ifdef HAVE_LCD_BITMAP
347#if LCD_WIDTH > 127 363 {1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on },
348 {8, S_O(scroll_step), 6, "scroll step", NULL }, /* 1...160 */ 364#if LCD_WIDTH > 255
365 {9, S_O(scroll_step), 6, "scroll step", NULL },
366 {9, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
367#elif LCD_WIDTH > 127
368 {8, S_O(scroll_step), 6, "scroll step", NULL },
369 {8, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
349#else 370#else
350 {7, S_O(scroll_step), 6, "scroll step", NULL }, /* 1...112 */ 371 {7, S_O(scroll_step), 6, "scroll step", NULL },
372 {7, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
351#endif 373#endif
352#endif /* HAVE_LCD_BITMAP */ 374#endif /* HAVE_LCD_BITMAP */
353 {8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */
354 {8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */
355#ifdef HAVE_LCD_CHARCELLS 375#ifdef HAVE_LCD_CHARCELLS
356 {3, S_O(jump_scroll), 0, "jump scroll", NULL }, /* 0...5 */ 376 {3, S_O(jump_scroll), 0, "jump scroll", NULL }, /* 0...5 */
357 {8, S_O(jump_scroll_delay), 50, "jump scroll delay", NULL }, /* 0...250 */ 377 {8, S_O(jump_scroll_delay), 50, "jump scroll delay", NULL }, /* 0...250 */
358#endif 378#endif
379 {1, S_O(scroll_paginated), false, "scroll paginated", off_on },
380
381#ifdef HAVE_LCD_COLOR
382 {LCD_DEPTH,S_O(fg_color),LCD_DEFAULT_FG,"foreground color","rgb"},
383 {LCD_DEPTH,S_O(bg_color),LCD_DEFAULT_BG,"background color","rgb"},
384#endif
385
359 /* more playback */ 386 /* more playback */
360 {1, S_O(play_selected), true, "play selected", off_on }, 387 {1, S_O(play_selected), true, "play selected", off_on },
361 {1, S_O(fade_on_stop), true, "volume fade", off_on }, 388 {1, S_O(fade_on_stop), true, "volume fade", off_on },
@@ -375,6 +402,7 @@ static const struct bit_entry hd_bits[] =
375#endif 402#endif
376 {8, S_O(disk_spindown), 5, "disk spindown", NULL }, 403 {8, S_O(disk_spindown), 5, "disk spindown", NULL },
377#endif /* HAVE_MMC */ 404#endif /* HAVE_MMC */
405
378 /* browser */ 406 /* browser */
379 {3, S_O(dirfilter), SHOW_SUPPORTED, 407 {3, S_O(dirfilter), SHOW_SUPPORTED,
380 "show files", "all,supported,music,playlists,id3 database" }, 408 "show files", "all,supported,music,playlists,id3 database" },
@@ -406,29 +434,6 @@ static const struct bit_entry hd_bits[] =
406 {7, S_O(peak_meter_min), 60, "peak meter min", NULL }, /* 0...100 */ 434 {7, S_O(peak_meter_min), 60, "peak meter min", NULL }, /* 0...100 */
407 {7, S_O(peak_meter_max), 0, "peak meter max", NULL }, /* 0...100 */ 435 {7, S_O(peak_meter_max), 0, "peak meter max", NULL }, /* 0...100 */
408#endif 436#endif
409#if CONFIG_CODEC == MAS3587F
410 /* recording */
411 {1, S_O(rec_editable), false, "editable recordings", off_on },
412 {4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
413 "off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" },
414 {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
415 {4, S_O(rec_mic_gain), 8, "rec mic gain", NULL },
416 {3, S_O(rec_quality), 5, "rec quality", NULL },
417#ifdef HAVE_SPDIF_IN
418 {2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
419#else
420 {1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
421#endif
422 {3, S_O(rec_frequency), 0, /* 0=44.1kHz */
423 "rec frequency", "44,48,32,22,24,16" },
424 {4, S_O(rec_left_gain), 2, /* 0dB */
425 "rec left gain", NULL }, /* 0...15 */
426 {4, S_O(rec_right_gain), 2, /* 0dB */
427 "rec right gain", NULL }, /* 0...15 */
428 {5, S_O(rec_prerecord_time), 0, "prerecording time", NULL }, /* 0...30 */
429 {1, S_O(rec_directory), 0, /* rec_base_directory */
430 "rec directory", REC_BASE_DIR ",current" },
431#endif
432#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 437#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
433 {7, S_O(mdb_strength), 0, "mdb strength", NULL}, 438 {7, S_O(mdb_strength), 0, "mdb strength", NULL},
434 {7, S_O(mdb_harmonics), 0, "mdb harmonics", NULL}, 439 {7, S_O(mdb_harmonics), 0, "mdb harmonics", NULL},
@@ -449,7 +454,37 @@ static const struct bit_entry hd_bits[] =
449 {1, S_O(id3_v1_first), 0, "id3 tag priority", "v2-v1,v1-v2"}, 454 {1, S_O(id3_v1_first), 0, "id3 tag priority", "v2-v1,v1-v2"},
450 455
451#ifdef HAVE_RECORDING 456#ifdef HAVE_RECORDING
457 /* recording */
452 {1, S_O(rec_startup), false, "rec screen on startup", off_on }, 458 {1, S_O(rec_startup), false, "rec screen on startup", off_on },
459 {4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
460 "off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" },
461 {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
462#ifdef HAVE_SPDIF_IN
463 {2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
464#else
465 {1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
466#endif
467 {5, S_O(rec_prerecord_time), 0, "prerecording time", NULL }, /* 0...30 */
468 {1, S_O(rec_directory), 0, /* rec_base_directory */
469 "rec directory", REC_BASE_DIR ",current" },
470#ifdef CONFIG_BACKLIGHT
471 {2, S_O(cliplight), 0, "cliplight", "off,main,both,remote" },
472#endif
473#if CONFIG_CODEC == MAS3587F
474 {4, S_O(rec_mic_gain), 8, "rec mic gain", NULL },
475 {4, S_O(rec_left_gain), 2 /* 0dB */, "rec left gain", NULL }, /* 0...15 */
476 {4, S_O(rec_right_gain), 2 /* 0dB */, "rec right gain", NULL }, /* 0...15 */
477 {3, S_O(rec_frequency), 0, /* 0=44.1kHz */
478 "rec frequency", "44,48,32,22,24,16" },
479 {1, S_O(rec_editable), false, "editable recordings", off_on },
480 {3, S_O(rec_quality), 5, "rec quality", NULL },
481#elif defined(HAVE_UDA1380)
482 {8|SIGNED, S_O(rec_mic_gain), 16 /* 8 dB */, "rec mic gain", NULL }, /* -128...+108 */
483 {8|SIGNED, S_O(rec_left_gain), 0, "rec left gain", NULL }, /* -128...+96 */
484 {8|SIGNED, S_O(rec_right_gain), 0, "rec right gain", NULL }, /* -128...+96 */
485 {3, S_O(rec_frequency), 0, /* 0=44.1kHz */
486 "rec frequency", "44,48,32,22,24,16" },
487#endif
453 488
454 /* values for the trigger */ 489 /* values for the trigger */
455 {8 | SIGNED, S_O(rec_start_thres), -35, "trigger start threshold", NULL}, 490 {8 | SIGNED, S_O(rec_start_thres), -35, "trigger start threshold", NULL},
@@ -458,14 +493,7 @@ static const struct bit_entry hd_bits[] =
458 {4, S_O(rec_stop_postrec), 2, "trigger stop postrec", trig_durations_conf}, 493 {4, S_O(rec_stop_postrec), 2, "trigger stop postrec", trig_durations_conf},
459 {4, S_O(rec_stop_gap), 1, "trigger min gap", trig_durations_conf}, 494 {4, S_O(rec_stop_gap), 1, "trigger min gap", trig_durations_conf},
460 {4, S_O(rec_trigger_mode ), 0, "trigger mode", "off,once,repeat"}, 495 {4, S_O(rec_trigger_mode ), 0, "trigger mode", "off,once,repeat"},
461#endif 496#endif /* HAVE_RECORDING */
462
463#ifdef HAVE_BACKLIGHT_PWM_FADING
464 /* backlight fading */
465 {2, S_O(backlight_fade_in), 1, "backlight fade in", "off,500ms,1s,2s"},
466 {3, S_O(backlight_fade_out), 3, "backlight fade out",
467 "off,500ms,1s,2s,3s,4s,5s,10s"},
468#endif
469 497
470#ifdef HAVE_SPDIF_POWER 498#ifdef HAVE_SPDIF_POWER
471 {1, S_O(spdif_enable), false, "spdif enable", off_on}, 499 {1, S_O(spdif_enable), false, "spdif enable", off_on},
@@ -492,59 +520,8 @@ static const struct bit_entry hd_bits[] =
492 {7, S_O(crossfeed_cross_gain), 60, "crossfeed cross gain", NULL }, 520 {7, S_O(crossfeed_cross_gain), 60, "crossfeed cross gain", NULL },
493 {8, S_O(crossfeed_hf_attenuation), 160, "crossfeed hf attenuation", NULL }, 521 {8, S_O(crossfeed_hf_attenuation), 160, "crossfeed hf attenuation", NULL },
494 {11, S_O(crossfeed_hf_cutoff), 700, "crossfeed hf cutoff", NULL }, 522 {11, S_O(crossfeed_hf_cutoff), 700, "crossfeed hf cutoff", NULL },
495#endif
496#ifdef HAVE_DIRCACHE
497 {1, S_O(dircache), false, "dircache", off_on },
498 {22, S_O(dircache_size), 0, NULL, NULL },
499#endif
500 523
501#if defined(HAVE_UDA1380) 524 /* equalizer */
502 /* recording settings for iriver */
503 {4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
504 "off,00:05,00:10,00:15,00:30,01:00,01:14,01:20,02:00,04:00,06:00,08:00,10:00,12:00,18:00,24:00" },
505 {1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
506 {4, S_O(rec_mic_gain), 4, "rec mic gain", NULL },
507#ifdef HAVE_SPDIF_IN
508 {2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
509#else
510 {1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
511#endif
512 {3, S_O(rec_frequency), 0, /* 0=44.1kHz */
513 "rec frequency", "44,48,32,22,24,16" },
514 {4, S_O(rec_left_gain), 2, /* 0dB */
515 "rec left gain", NULL }, /* 0...15 */
516 {4, S_O(rec_right_gain), 2, /* 0dB */
517 "rec right gain", NULL }, /* 0...15 */
518 {5, S_O(rec_prerecord_time), 0, "prerecording time", NULL }, /* 0...30 */
519 {1, S_O(rec_directory), 0, /* rec_base_directory */
520 "rec directory", REC_BASE_DIR ",current" },
521 {8|SIGNED, S_O(rec_linein_decimator_left_gain), 0, /* 0dB */
522 "line in decimator left gain", NULL }, /* -128...48 */
523 {8|SIGNED, S_O(rec_linein_decimator_right_gain), 0, /* 0dB */
524 "line in decimator right gain", NULL }, /* -128...48 */
525#endif
526
527#ifdef HAVE_REMOTE_LCD
528 {1, S_O(remote_caption_backlight), false,
529 "remote caption backlight", off_on },
530#endif
531 {4, S_O(default_codepage), 0, "default codepage", "iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256,iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8,cp1256" },
532
533#ifdef HAVE_BACKLIGHT_BRIGHTNESS
534 {4, S_O(brightness), 9, "brightness", NULL },
535#endif
536
537#ifdef HAVE_LCD_BITMAP
538 {1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on },
539#if LCD_WIDTH > 127
540 {8, S_O(screen_scroll_step), 16, "screen scroll step", NULL }, /* 1...160 */
541#else
542 {7, S_O(screen_scroll_step), 16, "screen scroll step", NULL }, /* 1...112 */
543#endif
544#endif /* HAVE_LCD_BITMAP */
545 {1, S_O(warnon_erase_dynplaylist), false,
546 "warn when erasing dynamic playlist", off_on },
547#if CONFIG_CODEC == SWCODEC
548 {1, S_O(eq_enabled), false, "eq enabled", off_on }, 525 {1, S_O(eq_enabled), false, "eq enabled", off_on },
549 {8, S_O(eq_precut), 0, "eq precut", NULL }, 526 {8, S_O(eq_precut), 0, "eq precut", NULL },
550 /* 0..32768 Hz */ 527 /* 0..32768 Hz */
@@ -566,28 +543,19 @@ static const struct bit_entry hd_bits[] =
566 {9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL }, 543 {9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL },
567 {9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL }, 544 {9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL },
568#endif 545#endif
569#if defined(HAVE_UDA1380) /* PLEASE merge this with the other UDA1380 define
570 when bumping the settings version number PLEASE */
571 {8|SIGNED, S_O(rec_mic_decimator_left_gain), 0, /* 0dB */
572 "mic decimator left gain", NULL }, /* -128...48 */
573 {8|SIGNED, S_O(rec_mic_decimator_right_gain), 0, /* 0dB */
574 "mic decimator right gain", NULL }, /* -128...48 */
575#endif
576 {1, S_O(scroll_paginated), false, "scroll paginated", off_on },
577#ifdef HAVE_RECORDING
578#ifdef CONFIG_BACKLIGHT
579 {2, S_O(cliplight), 0, "cliplight", "off,main,both,remote" },
580#endif /* CONFIG_BACKLIGHT */
581#endif /*HAVE_RECORDING*/
582#ifdef HAVE_LCD_COLOR
583 {LCD_DEPTH,S_O(fg_color),LCD_DEFAULT_FG,"foreground color","rgb"},
584 {LCD_DEPTH,S_O(bg_color),LCD_DEFAULT_BG,"background color","rgb"},
585#endif
586 546
587#ifdef HAVE_DIRCACHE 547#ifdef HAVE_DIRCACHE
548 {1, S_O(dircache), false, "dircache", off_on },
549 {22, S_O(dircache_size), 0, NULL, NULL },
588 {1, S_O(tagcache_ram), 0, "tagcache_ram", off_on }, 550 {1, S_O(tagcache_ram), 0, "tagcache_ram", off_on },
589#endif 551#endif
590 552
553 {4, S_O(default_codepage), 0, "default codepage",
554 "iso8859-1,iso8859-7,iso8859-8,cp1251,iso8859-11,cp1256,iso8859-9,iso8859-2,sjis,gb2312,ksx1001,big5,utf-8,cp1256" },
555
556 {1, S_O(warnon_erase_dynplaylist), false,
557 "warn when erasing dynamic playlist", off_on },
558
591 /* If values are just added to the end, no need to bump the version. */ 559 /* If values are just added to the end, no need to bump the version. */
592 /* new stuff to be added at the end */ 560 /* new stuff to be added at the end */
593 561
diff --git a/apps/settings.h b/apps/settings.h
index 8a657999e2..fd03d93f43 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -229,12 +229,6 @@ struct user_settings
229 int rec_mic_gain; /* 0-15 */ 229 int rec_mic_gain; /* 0-15 */
230 int rec_left_gain; /* 0-15 */ 230 int rec_left_gain; /* 0-15 */
231 int rec_right_gain; /* 0-15 */ 231 int rec_right_gain; /* 0-15 */
232#ifdef HAVE_UDA1380
233 int rec_linein_decimator_left_gain; /* -128 .. 48 */
234 int rec_linein_decimator_right_gain; /* -128 .. 48 */
235 int rec_mic_decimator_left_gain; /* -128 .. 48 */
236 int rec_mic_decimator_right_gain; /* -128 .. 48 */
237#endif
238 bool rec_editable; /* true means that the bit reservoir is off */ 232 bool rec_editable; /* true means that the bit reservoir is off */
239 233
240 /* note: timesplit setting is not saved */ 234 /* note: timesplit setting is not saved */
diff --git a/firmware/drivers/uda1380.c b/firmware/drivers/uda1380.c
index e787c1c253..5a0ecf08ca 100644
--- a/firmware/drivers/uda1380.c
+++ b/firmware/drivers/uda1380.c
@@ -29,6 +29,7 @@
29#include "file.h" 29#include "file.h"
30#include "buffer.h" 30#include "buffer.h"
31#include "audio.h" 31#include "audio.h"
32#include "logf.h"
32 33
33#include "i2c-coldfire.h" 34#include "i2c-coldfire.h"
34#include "uda1380.h" 35#include "uda1380.h"
@@ -255,27 +256,37 @@ void uda1380_disable_recording(void)
255/** 256/**
256 * Set recording gain and volume 257 * Set recording gain and volume
257 * 258 *
258 * type: params: ranges: 259 * type: params: ranges:
259 * AUDIO_GAIN_MIC left 0 .. 15 -> 0 .. 30 dB gain 260 * AUDIO_GAIN_MIC: left -128 .. 108 -> -64 .. 54 dB gain
260 * AUDIO_GAIN_LINEIN left & right 0 .. 8 -> 0 .. 24 dB gain 261 * AUDIO_GAIN_LINEIN left & right -128 .. 96 -> -64 .. 48 dB gain
261 * AUDIO_GAIN_DECIMATOR left & right -128 .. 48 -> -64 .. 24 dB gain
262 * 262 *
263 * Note: For all types the value 0 gives 0 dB gain. 263 * Note: For all types the value 0 gives 0 dB gain.
264 */ 264 */
265void uda1380_set_recvol(int left, int right, int type) 265void uda1380_set_recvol(int left, int right, int type)
266{ 266{
267 int left_ag, right_ag;
268
267 switch (type) 269 switch (type)
268 { 270 {
269 case AUDIO_GAIN_MIC: 271 case AUDIO_GAIN_MIC:
270 uda1380_write_reg(REG_ADC, (uda1380_regs[REG_ADC] & ~VGA_GAIN_MASK) | VGA_GAIN(left)); 272 left_ag = MIN(MAX(0, left / 4), 15);
273 left -= left_ag * 4;
274 uda1380_write_reg(REG_ADC, (uda1380_regs[REG_ADC] & ~VGA_GAIN_MASK)
275 | VGA_GAIN(left_ag));
276 uda1380_write_reg(REG_DEC_VOL, DEC_VOLL(left) | DEC_VOLR(left));
277 logf("Mic: %dA/%dD", left_ag, left);
271 break; 278 break;
272 279
273 case AUDIO_GAIN_LINEIN: 280 case AUDIO_GAIN_LINEIN:
274 uda1380_write_reg(REG_PGA, (uda1380_regs[REG_PGA] & ~PGA_GAIN_MASK) | PGA_GAINL(left) | PGA_GAINR(right)); 281 left_ag = MIN(MAX(0, left / 6), 8);
275 break; 282 left -= left_ag * 6;
276 283 right_ag = MIN(MAX(0, right / 6), 8);
277 case AUDIO_GAIN_DECIMATOR: 284 right -= right_ag * 6;
285 uda1380_write_reg(REG_PGA, (uda1380_regs[REG_PGA] & ~PGA_GAIN_MASK)
286 | PGA_GAINL(left_ag) | PGA_GAINR(right_ag));
278 uda1380_write_reg(REG_DEC_VOL, DEC_VOLL(left) | DEC_VOLR(right)); 287 uda1380_write_reg(REG_DEC_VOL, DEC_VOLL(left) | DEC_VOLR(right));
288 logf("Line L: %dA/%dD", left_ag, left);
289 logf("Line R: %dA/%dD", right_ag, right);
279 break; 290 break;
280 } 291 }
281} 292}
diff --git a/firmware/export/audio.h b/firmware/export/audio.h
index b44bb91378..9e3499e81f 100644
--- a/firmware/export/audio.h
+++ b/firmware/export/audio.h
@@ -35,7 +35,6 @@
35 35
36#define AUDIO_GAIN_LINEIN 0 36#define AUDIO_GAIN_LINEIN 0
37#define AUDIO_GAIN_MIC 1 37#define AUDIO_GAIN_MIC 1
38#define AUDIO_GAIN_DECIMATOR 2 /* for UDA1380 */
39 38
40 39
41struct audio_debug 40struct audio_debug
diff --git a/firmware/export/sound.h b/firmware/export/sound.h
index dae124d8f7..a49cb99263 100644
--- a/firmware/export/sound.h
+++ b/firmware/export/sound.h
@@ -41,10 +41,6 @@ enum {
41 SOUND_RIGHT_GAIN, 41 SOUND_RIGHT_GAIN,
42 SOUND_MIC_GAIN, 42 SOUND_MIC_GAIN,
43#endif 43#endif
44#if defined(HAVE_UDA1380)
45 SOUND_DECIMATOR_LEFT_GAIN,
46 SOUND_DECIMATOR_RIGHT_GAIN,
47#endif
48}; 44};
49 45
50enum { 46enum {
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c
index 0a70494288..ea444a31e1 100644
--- a/firmware/pcm_record.c
+++ b/firmware/pcm_record.c
@@ -348,12 +348,11 @@ void audio_set_recording_options(int frequency, int quality,
348 * Note that microphone is mono, only left value is used 348 * Note that microphone is mono, only left value is used
349 * See uda1380_set_recvol() for exact ranges. 349 * See uda1380_set_recvol() for exact ranges.
350 * 350 *
351 * @param type 0=line-in (radio), 1=mic, 2=ADC 351 * @param type 0=line-in (radio), 1=mic
352 * 352 *
353 */ 353 */
354void audio_set_recording_gain(int left, int right, int type) 354void audio_set_recording_gain(int left, int right, int type)
355{ 355{
356 //logf("rcmrec: t=%d l=%d r=%d", type, left, right);
357 uda1380_set_recvol(left, right, type); 356 uda1380_set_recvol(left, right, type);
358} 357}
359 358
diff --git a/firmware/sound.c b/firmware/sound.c
index 7768afd909..057cfc0995 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -108,11 +108,9 @@ static const struct sound_settings_info sound_settings_table[] = {
108 [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL}, 108 [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
109 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL}, 109 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL},
110#elif defined(HAVE_UDA1380) 110#elif defined(HAVE_UDA1380)
111 [SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 8, 8, NULL}, 111 [SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
112 [SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 8, 8, NULL}, 112 [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
113 [SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL}, 113 [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16, NULL},
114 [SOUND_DECIMATOR_LEFT_GAIN] = {"dB", 1, 1,-128, 48, 0, NULL},
115 [SOUND_DECIMATOR_RIGHT_GAIN]= {"dB", 1, 1,-128, 48, 0, NULL},
116#endif 114#endif
117}; 115};
118 116
@@ -894,19 +892,11 @@ int sound_val2phys(int setting, int value)
894 { 892 {
895 case SOUND_LEFT_GAIN: 893 case SOUND_LEFT_GAIN:
896 case SOUND_RIGHT_GAIN: 894 case SOUND_RIGHT_GAIN:
897 result = value * 30; /* (24/8) *10 */
898 break;
899
900 case SOUND_MIC_GAIN: 895 case SOUND_MIC_GAIN:
901 result = value * 20; /* (30/15) *10 */ 896 result = value * 5; /* (1/2) * 10 */
902 break;
903
904 case SOUND_DECIMATOR_LEFT_GAIN:
905 case SOUND_DECIMATOR_RIGHT_GAIN:
906 result = value * 5; /* (1/2) *10 */
907 break; 897 break;
908 898
909 default: 899 default:
910 result = value; 900 result = value;
911 break; 901 break;
912 } 902 }