From db734b41d5004fabd7a0cb110040d7a05bd0adb4 Mon Sep 17 00:00:00 2001 From: Hristo Kovachev Date: Wed, 8 Feb 2006 13:08:55 +0000 Subject: 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 --- apps/lang/english.lang | 15 +- apps/recorder/radio.c | 2 +- apps/recorder/recording.c | 481 ++++++++++++++++++++++++++++++++++++++-------- apps/settings.c | 16 +- apps/settings.h | 6 +- apps/sound_menu.c | 37 ++-- 6 files changed, 444 insertions(+), 113 deletions(-) (limited to 'apps') diff --git a/apps/lang/english.lang b/apps/lang/english.lang index 6ba5e39c9f..1a342420b4 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -3354,13 +3354,13 @@ voice: "Fade out mode" new: id: LANG_RECORDING_ADC_RIGHT -desc: in the recording settings +desc: DEPRECATED eng: "ADC Gain Right" voice: "ADC Gain Right" new: id: LANG_RECORDING_ADC_LEFT -desc: in the recording settings +desc: DEPRECATED eng: "ADC Gain Left" voice: "ADC Gain Left" new: @@ -3707,3 +3707,14 @@ eng: "High Shelf Filter" voice: "" new: +id: LANG_RECORDING_GAIN_ANALOG +desc: in the recording screen +eng: "A" +voice: "Analog Gain" +new: + +id: LANG_RECORDING_GAIN_DIGITAL +desc: in the recording screen +eng: "D" +voice: "Digital Gain" +new: 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) sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN); #else uda1380_enable_recording(false); - uda1380_set_recvol(10, 10, AUDIO_GAIN_ADC); + uda1380_set_recvol(10, 10, AUDIO_GAIN_DECIMATOR); uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN); uda1380_set_monitor(true); 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) { if(global_settings.rec_source == SOURCE_MIC) { - audio_set_recording_gain(global_settings.rec_mic_gain, 0, AUDIO_GAIN_MIC); + audio_set_recording_gain(global_settings.rec_mic_gain, + 0, AUDIO_GAIN_MIC); +#ifdef HAVE_UDA1380 + audio_set_recording_gain(global_settings.rec_mic_decimator_left_gain, + global_settings.rec_mic_decimator_right_gain, + AUDIO_GAIN_DECIMATOR); +#endif } else { audio_set_recording_gain(global_settings.rec_left_gain, - global_settings.rec_right_gain, AUDIO_GAIN_LINEIN); - } + global_settings.rec_right_gain, + AUDIO_GAIN_LINEIN); #ifdef HAVE_UDA1380 - audio_set_recording_gain(global_settings.rec_adc_left_gain, - global_settings.rec_adc_right_gain, - AUDIO_GAIN_ADC); + audio_set_recording_gain(global_settings.rec_linein_decimator_left_gain, + global_settings.rec_linein_decimator_right_gain, + AUDIO_GAIN_DECIMATOR); #endif + } } static const char* const fmtstr[] = { - "%d %s", /* no decimals */ - "%d.%d %s ", /* 1 decimal */ - "%d.%02d %s " /* 2 decimals */ + "%c%d %s", /* no decimals */ + "%c%d.%d %s ", /* 1 decimal */ + "%c%d.%02d %s " /* 2 decimals */ }; char *fmt_gain(int snd, int val, char *str, int len) { - int tmp, i, d, numdec; + int i, d, numdec; const char *unit; - - tmp = sound_val2phys(snd, val); + + val = sound_val2phys(snd, val); + char sign = ' '; + if(val < 0) + { + sign = '-'; + val = abs(val); + } numdec = sound_numdecimals(snd); unit = sound_unit(snd); if(numdec) { - i = tmp / (10*numdec); - d = abs(tmp % (10*numdec)); - snprintf(str, len, fmtstr[numdec], i, d, unit); + i = val / (10*numdec); + d = val % (10*numdec); + snprintf(str, len, fmtstr[numdec], sign, i, d, unit); } else - snprintf(str, len, fmtstr[numdec], tmp, unit); + snprintf(str, len, fmtstr[numdec], sign, val, unit); + + return str; +} + +char *fmt_gain2(int snd1, int val1, int snd2, int val2, char *str, int len) +{ + /* same as above but for combined (added) values (recording gain) */ + int i, d, numdec; + const char *unit; + + int val = sound_val2phys(snd1, val1) + sound_val2phys(snd2, val2); + char sign = ' '; + if(val < 0) + { + sign = '-'; + val = abs(val); + } + numdec = MAX(sound_numdecimals(snd1), sound_numdecimals(snd2)); + unit = sound_unit(snd1); /* should be same! */ + + if(numdec) + { + i = val / (10*numdec); + d = val % (10*numdec); + snprintf(str, len, fmtstr[numdec], sign, i, d, unit); + } + else + snprintf(str, len, fmtstr[numdec], sign, val, unit); return str; } @@ -190,7 +231,6 @@ void adjust_cursor(void) case SOURCE_MIC: max_cursor = 1; break; - case SOURCE_LINE: max_cursor = 3; break; @@ -198,7 +238,7 @@ void adjust_cursor(void) max_cursor = 0; break; } - + if(cursor > max_cursor) cursor = max_cursor; } @@ -292,6 +332,158 @@ static void trigger_listener(int trigger_status) } } +#ifdef HAVE_UDA1380 +/* Handles combined recording gain changes. + GAIN RANGE = negative digital / analog / positive digital + */ +void change_recording_gain(bool increment, bool left, bool right, + int ana_mic_size, int ana_line_size) +{ + if (increment) + { + if(global_settings.rec_source == SOURCE_MIC) + { + /* always changed as stereo */ + if(global_settings.rec_mic_decimator_left_gain < + sound_max(SOUND_DECIMATOR_LEFT_GAIN)) + { + /* increase digital gain by 1 if below max */ + global_settings.rec_mic_decimator_left_gain++; + global_settings.rec_mic_decimator_right_gain = + global_settings.rec_mic_decimator_left_gain; + } + + /* mono increase */ + if((global_settings.rec_mic_decimator_left_gain >= ana_mic_size) && + (global_settings.rec_mic_gain < sound_max(SOUND_MIC_GAIN))) + { + /* in analogue range, cycle digital gain for each analogue */ + global_settings.rec_mic_decimator_left_gain = 0; + global_settings.rec_mic_decimator_right_gain = + global_settings.rec_mic_decimator_left_gain; + global_settings.rec_mic_gain++; + } + } + else + { + if(((left) && (right)) && + (global_settings.rec_linein_decimator_left_gain < + sound_max(SOUND_DECIMATOR_LEFT_GAIN)) && + (global_settings.rec_linein_decimator_right_gain < + sound_max(SOUND_DECIMATOR_RIGHT_GAIN)) ) + { + /* increase digital gain by 1 if below max*/ + global_settings.rec_linein_decimator_left_gain++; + global_settings.rec_linein_decimator_right_gain++; + } + else if((right) && (!left) && + (global_settings.rec_linein_decimator_right_gain < + sound_max(SOUND_DECIMATOR_RIGHT_GAIN))) + { + global_settings.rec_linein_decimator_right_gain++; + } + else if((left) && (!right) && + (global_settings.rec_linein_decimator_left_gain < + sound_max(SOUND_DECIMATOR_LEFT_GAIN))) + { + global_settings.rec_linein_decimator_left_gain++; + } + + /* Stereo increase */ + if((left) && + (global_settings.rec_linein_decimator_left_gain >= + ana_line_size) && + (global_settings.rec_left_gain < sound_max(SOUND_LEFT_GAIN))) + { + /* if analogue range cycle left digital gain for each */ + global_settings.rec_linein_decimator_left_gain = 0; + global_settings.rec_left_gain++; + } + if((right) && + (global_settings.rec_linein_decimator_right_gain >= + ana_line_size) && + (global_settings.rec_right_gain < sound_max(SOUND_RIGHT_GAIN))) + { + /* if analogue range cycle right digital for each */ + global_settings.rec_linein_decimator_right_gain = 0; + global_settings.rec_right_gain++; + } + } + } + else + { + if(global_settings.rec_source == SOURCE_MIC) + { + /* always changed as stereo */ + if(global_settings.rec_mic_decimator_left_gain > + sound_min(SOUND_DECIMATOR_LEFT_GAIN)) + { + /* decrease digital gain by 1 if above minimum */ + global_settings.rec_mic_decimator_left_gain--; + global_settings.rec_mic_decimator_right_gain = + global_settings.rec_mic_decimator_left_gain; + } + + /* mono decrease */ + if((global_settings.rec_mic_decimator_left_gain < 0) && + (global_settings.rec_mic_gain > sound_min(SOUND_MIC_GAIN))) + { + /* if analogue in range, cycle digital gain for each */ + global_settings.rec_mic_decimator_left_gain = ana_mic_size - 1; + global_settings.rec_mic_decimator_right_gain = + global_settings.rec_mic_decimator_left_gain; + global_settings.rec_mic_gain--; + } + } + else + { + if( ((left) && (right)) && + (global_settings.rec_linein_decimator_left_gain > + sound_min(SOUND_DECIMATOR_LEFT_GAIN)) && + (global_settings.rec_linein_decimator_right_gain > + sound_min(SOUND_DECIMATOR_RIGHT_GAIN)) ) + { + /* decrease digital gain by 1 if above minimum */ + global_settings.rec_linein_decimator_left_gain--; + global_settings.rec_linein_decimator_right_gain--; + } + else if((right) && (!left) && + (global_settings.rec_linein_decimator_right_gain > + sound_min(SOUND_DECIMATOR_RIGHT_GAIN))) + { + global_settings.rec_linein_decimator_right_gain--; + } + else if((left) && (!right) && + (global_settings.rec_linein_decimator_left_gain > + sound_min(SOUND_DECIMATOR_LEFT_GAIN))) + { + global_settings.rec_linein_decimator_left_gain--; + } + + /* Stereo decrease */ + if((left) && + (global_settings.rec_linein_decimator_left_gain < 0) && + (global_settings.rec_left_gain > sound_min(SOUND_LEFT_GAIN))) + { + /* if in analogue range cycle left digital gain for each */ + global_settings.rec_left_gain--; + global_settings.rec_linein_decimator_left_gain = + ana_line_size - 1; + } + if((right) && + (global_settings.rec_linein_decimator_right_gain < 0) && + (global_settings.rec_right_gain > sound_min(SOUND_RIGHT_GAIN))) + { + /* if in analogue range cycle right digital gain for each */ + global_settings.rec_right_gain--; + global_settings.rec_linein_decimator_right_gain = + ana_line_size - 1; + } + } + } +} +#endif /* UDA1380 */ + bool recording_screen(void) { long button; @@ -299,7 +491,6 @@ bool recording_screen(void) bool done = false; char buf[32]; char buf2[32]; - int gain; int w, h; int update_countdown = 1; bool have_recorded = false; @@ -314,6 +505,22 @@ bool recording_screen(void) int led_countdown = 2; #endif +#ifdef HAVE_UDA1380 +/*calculate no. of digital steps to each analogue step. Assuming + left dig step = right dig step, and there is an integer no. of digital steps + in each analogue*/ + int ana_mic_size = sound_val2phys(SOUND_MIC_GAIN, 1) / + sound_val2phys(SOUND_DECIMATOR_LEFT_GAIN, 1); + int ana_line_size = sound_val2phys(SOUND_LEFT_GAIN, 1) / + sound_val2phys(SOUND_DECIMATOR_LEFT_GAIN, 1); + + if(global_settings.rec_source == SOURCE_MIC) + { + global_settings.rec_mic_decimator_left_gain = + global_settings.rec_mic_decimator_right_gain; + } +#endif + const unsigned char *byte_units[] = { ID2P(LANG_BYTE), ID2P(LANG_KILOBYTE), @@ -516,7 +723,7 @@ bool recording_screen(void) update_countdown = 1; /* Update immediately */ break; #endif - + case REC_INC: case REC_INC | BUTTON_REPEAT: switch(cursor) @@ -527,7 +734,20 @@ bool recording_screen(void) global_settings.volume++; sound_set_volume(global_settings.volume); break; - +#ifdef HAVE_UDA1380 + case 1: + change_recording_gain(true, true, true, + ana_mic_size, ana_line_size); + break; + case 2: + change_recording_gain(true, true, false, + ana_mic_size, ana_line_size); + break; + case 3: + change_recording_gain(true, false, true, + ana_mic_size, ana_line_size); + break; +#else case 1: if(global_settings.rec_source == SOURCE_MIC) { @@ -537,12 +757,12 @@ bool recording_screen(void) } else { - gain = MAX(global_settings.rec_left_gain, - global_settings.rec_right_gain); - if(gain < sound_max(SOUND_LEFT_GAIN)) - gain++; - global_settings.rec_left_gain = gain; - global_settings.rec_right_gain = gain; + if(global_settings.rec_left_gain < + sound_max(SOUND_LEFT_GAIN)) + global_settings.rec_left_gain++; + if(global_settings.rec_right_gain < + sound_max(SOUND_RIGHT_GAIN)) + global_settings.rec_right_gain++; } break; case 2: @@ -555,6 +775,7 @@ bool recording_screen(void) sound_max(SOUND_RIGHT_GAIN)) global_settings.rec_right_gain++; break; +#endif } set_gain(); update_countdown = 1; /* Update immediately */ @@ -570,7 +791,23 @@ bool recording_screen(void) global_settings.volume--; sound_set_volume(global_settings.volume); break; - +#ifdef HAVE_UDA1380 + case 1: + /* both channels */ + change_recording_gain(false, true, true, + ana_mic_size, ana_line_size); + break; + case 2: + /* only left */ + change_recording_gain(false, true, false, + ana_mic_size, ana_line_size); + break; + case 3: + /* only right */ + change_recording_gain(false, false, true, + ana_mic_size, ana_line_size); + break; +#else case 1: if(global_settings.rec_source == SOURCE_MIC) { @@ -580,12 +817,12 @@ bool recording_screen(void) } else { - gain = MAX(global_settings.rec_left_gain, - global_settings.rec_right_gain); - if(gain > sound_min(SOUND_LEFT_GAIN)) - gain--; - global_settings.rec_left_gain = gain; - global_settings.rec_right_gain = gain; + if(global_settings.rec_left_gain > + sound_min(SOUND_LEFT_GAIN)) + global_settings.rec_left_gain--; + if(global_settings.rec_right_gain > + sound_min(SOUND_RIGHT_GAIN)) + global_settings.rec_right_gain--; } break; case 2: @@ -598,6 +835,7 @@ bool recording_screen(void) sound_min(SOUND_RIGHT_GAIN)) global_settings.rec_right_gain--; break; +#endif } set_gain(); update_countdown = 1; /* Update immediately */ @@ -777,64 +1015,149 @@ bool recording_screen(void) lcd_puts_style(0, 3, buf, STYLE_INVERT); else lcd_puts(0, 3, buf); + if(global_settings.rec_source == SOURCE_MIC) - { - snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), + { +#ifdef HAVE_UDA1380 + + /*****************test info code*********************** + snprintf(buf, 32, "Aa:(2x) %d DigL:(0.5x) %d ", + global_settings.rec_mic_gain, + global_settings.rec_mic_decimator_left_gain); + lcd_puts(0, 10, buf); + snprintf(buf, 32, "DigR:(0.5x) %d", + global_settings.rec_mic_decimator_right_gain); + lcd_puts(9, 12, buf); + *****************test info code***********************/ + + snprintf(buf, 32, "%s:%s (%s)", + str(LANG_RECORDING_GAIN), + fmt_gain2(SOUND_MIC_GAIN, + global_settings.rec_mic_gain, + SOUND_DECIMATOR_LEFT_GAIN, + global_settings.rec_mic_decimator_left_gain, + buf2, sizeof(buf2)), + (((global_settings.rec_mic_gain == + sound_max(SOUND_MIC_GAIN)) && + (global_settings.rec_mic_decimator_left_gain > 0))|| + ((global_settings.rec_mic_gain == + sound_min(SOUND_MIC_GAIN)) && + (global_settings.rec_mic_decimator_left_gain < 0)))? + str(LANG_RECORDING_GAIN_DIGITAL) : + str(LANG_RECORDING_GAIN_ANALOG) + ); +#else /* HAVE_UDA1380 */ + snprintf(buf, 32, "%s:%s", str(LANG_RECORDING_GAIN), fmt_gain(SOUND_MIC_GAIN, global_settings.rec_mic_gain, buf2, sizeof(buf2))); - if (global_settings.invert_cursor && (pos++ == cursor)) +#endif + if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) lcd_puts_style(0, 4, buf, STYLE_INVERT); else lcd_puts(0, 4, buf); } - else + else if(global_settings.rec_source == SOURCE_LINE) { - if(global_settings.rec_source == SOURCE_LINE) - { - gain = MAX(global_settings.rec_left_gain, - global_settings.rec_right_gain); - - snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_GAIN), - fmt_gain(SOUND_LEFT_GAIN, gain, - buf2, sizeof(buf2))); - if (global_settings.invert_cursor && (pos++ == cursor)) - lcd_puts_style(0, 4, buf, STYLE_INVERT); - else - lcd_puts(0, 4, buf); - - snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_LEFT), - fmt_gain(SOUND_LEFT_GAIN, - global_settings.rec_left_gain, - buf2, sizeof(buf2))); - if (global_settings.invert_cursor && (pos++ == cursor)) - lcd_puts_style(0, 5, buf, STYLE_INVERT); - else - lcd_puts(0, 5, buf); - - snprintf(buf, 32, "%s: %s", str(LANG_RECORDING_RIGHT), - fmt_gain(SOUND_RIGHT_GAIN, - global_settings.rec_right_gain, - buf2, sizeof(buf2))); - if (global_settings.invert_cursor && (pos == cursor)) - lcd_puts_style(0, 6, buf, STYLE_INVERT); - else - lcd_puts(0, 6, buf); - } - } +#ifdef HAVE_UDA1380 - put_cursorxy(0, 3 + cursor, true); - - if (global_settings.rec_source != SOURCE_LINE) { - snprintf(buf, 32, "%s %s [%d]", - freq_str[global_settings.rec_frequency], - global_settings.rec_channels? - str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO), - global_settings.rec_quality); - lcd_puts(0, 6, buf); + /*****************test info code*********************** + snprintf(buf, 32, "AL:(3x) %d DigL:(0.5x) %d", + global_settings.rec_left_gain, + global_settings.rec_linein_decimator_left_gain); + lcd_puts(0, 10, buf); + snprintf(buf, 32, "AR:(3x) %d DigR:(0.5x) %d", + global_settings.rec_right_gain, + global_settings.rec_linein_decimator_right_gain); + lcd_puts(0, 12, buf); + *****************test info code***********************/ + + snprintf(buf, 32, "%s:%s (%s)", + str(LANG_RECORDING_LEFT), + fmt_gain2(SOUND_LEFT_GAIN, + global_settings.rec_left_gain, + SOUND_DECIMATOR_LEFT_GAIN, + global_settings.rec_linein_decimator_left_gain, + buf2, sizeof(buf2)), + (((global_settings.rec_left_gain == + sound_max(SOUND_LEFT_GAIN)) && + (global_settings.rec_linein_decimator_left_gain + > 0)) || + ((global_settings.rec_left_gain == + sound_min(SOUND_LEFT_GAIN)) && + (global_settings.rec_linein_decimator_left_gain + < 0))) ? + str(LANG_RECORDING_GAIN_DIGITAL) : + str(LANG_RECORDING_GAIN_ANALOG) + ); +#else /* HAVE_UDA1380 */ + snprintf(buf, 32, "%s:%s", + str(LANG_RECORDING_LEFT), + fmt_gain(SOUND_LEFT_GAIN, + global_settings.rec_left_gain, + buf2, sizeof(buf2))); +#endif /* HAVE_UDA1380 */ + if(global_settings.invert_cursor && ((1==cursor)||(2==cursor))) + lcd_puts_style(0, 4, buf, STYLE_INVERT); + else + lcd_puts(0, 4, buf); +#ifdef HAVE_UDA1380 + snprintf(buf, 32, "%s:%s (%s)", + str(LANG_RECORDING_RIGHT), + fmt_gain2(SOUND_RIGHT_GAIN, + global_settings.rec_right_gain, + SOUND_DECIMATOR_RIGHT_GAIN, + global_settings.rec_linein_decimator_right_gain, + buf2, sizeof(buf2)), + (((global_settings.rec_right_gain == + sound_max(SOUND_RIGHT_GAIN)) && + (global_settings.rec_linein_decimator_right_gain + > 0)) || + ((global_settings.rec_right_gain == + sound_min(SOUND_RIGHT_GAIN)) && + (global_settings.rec_linein_decimator_right_gain + < 0))) ? + str(LANG_RECORDING_GAIN_DIGITAL) : + str(LANG_RECORDING_GAIN_ANALOG) + ); +#else /* HAVE_UDA1380 */ + snprintf(buf, 32, "%s:%s", + str(LANG_RECORDING_RIGHT), + fmt_gain(SOUND_RIGHT_GAIN, + global_settings.rec_right_gain, + buf2, sizeof(buf2))); +#endif /* HAVE_UDA1380 */ + if(global_settings.invert_cursor && ((1==cursor)||(3==cursor))) + lcd_puts_style(0, 5, buf, STYLE_INVERT); + else + lcd_puts(0, 5, buf); + } + switch(cursor) + { + case 1: + put_cursorxy(0, 4, true); + + if(global_settings.rec_source != SOURCE_MIC) + put_cursorxy(0, 5, true); + + break; + case 2: + put_cursorxy(0, 4, true); + break; + case 3: + put_cursorxy(0, 5, true); + break; + default: + put_cursorxy(0, 0, true); } + snprintf(buf, 32, "%s %s", + freq_str[global_settings.rec_frequency], + global_settings.rec_channels? + str(LANG_CHANNEL_MONO):str(LANG_CHANNEL_STEREO)); + lcd_puts(0, 7, buf); + gui_syncstatusbar_draw(&statusbars, true); peak_meter_draw(0, 8 + h*2, LCD_WIDTH, h); diff --git a/apps/settings.c b/apps/settings.c index ea8c562a04..2f782f46de 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -485,8 +485,10 @@ static const struct bit_entry hd_bits[] = {5, S_O(rec_prerecord_time), 0, "prerecording time", NULL }, /* 0...30 */ {1, S_O(rec_directory), 0, /* rec_base_directory */ "rec directory", REC_BASE_DIR ",current" }, - {8|SIGNED, S_O(rec_adc_left_gain), 0, /* 0dB */ "adc left gain", NULL }, /* -128...48 */ - {8|SIGNED, S_O(rec_adc_right_gain), 0, /* 0dB */ "adc right gain", NULL }, /* -128...48 */ + {8|SIGNED, S_O(rec_linein_decimator_left_gain), 0, /* 0dB */ + "line in decimator left gain", NULL }, /* -128...48 */ + {8|SIGNED, S_O(rec_linein_decimator_right_gain), 0, /* 0dB */ + "line in decimator right gain", NULL }, /* -128...48 */ #endif #ifdef HAVE_REMOTE_LCD @@ -507,10 +509,8 @@ static const struct bit_entry hd_bits[] = {7, S_O(screen_scroll_step), 16, "screen scroll step", NULL }, /* 1...112 */ #endif #endif /* HAVE_LCD_BITMAP */ - {1, S_O(warnon_erase_dynplaylist), false, "warn when erasing dynamic playlist", off_on }, - #if CONFIG_CODEC == SWCODEC {1, S_O(eq_enabled), false, "eq enabled", off_on }, /* 0..32768 Hz */ @@ -532,7 +532,13 @@ static const struct bit_entry hd_bits[] = {9|SIGNED, S_O(eq_band3_gain), 0, "eq band 3 gain", NULL }, {9|SIGNED, S_O(eq_band4_gain), 0, "eq band 4 gain", NULL }, #endif - +#if defined(HAVE_UDA1380) /* PLEASE merge this with the other UDA1380 define + when bumping the settings version number PLEASE */ + {8|SIGNED, S_O(rec_mic_decimator_left_gain), 0, /* 0dB */ + "mic decimator left gain", NULL }, /* -128...48 */ + {8|SIGNED, S_O(rec_mic_decimator_right_gain), 0, /* 0dB */ + "mic decimator right gain", NULL }, /* -128...48 */ +#endif /* If values are just added to the end, no need to bump the version. */ /* new stuff to be added at the end */ diff --git a/apps/settings.h b/apps/settings.h index 6efaacbaf3..20877b1f75 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -217,8 +217,10 @@ struct user_settings int rec_left_gain; /* 0-15 */ int rec_right_gain; /* 0-15 */ #ifdef HAVE_UDA1380 - int rec_adc_left_gain; /* -128 .. 48 */ - int rec_adc_right_gain; /* -128 .. 48 */ + int rec_linein_decimator_left_gain; /* -128 .. 48 */ + int rec_linein_decimator_right_gain; /* -128 .. 48 */ + int rec_mic_decimator_left_gain; /* -128 .. 48 */ + int rec_mic_decimator_right_gain; /* -128 .. 48 */ #endif bool rec_editable; /* true means that the bit reservoir is off */ diff --git a/apps/sound_menu.c b/apps/sound_menu.c index 9c8d398029..e4820b3379 100644 --- a/apps/sound_menu.c +++ b/apps/sound_menu.c @@ -18,6 +18,7 @@ ****************************************************************************/ #include "config.h" #include +#include #include #include "system.h" #include "kernel.h" @@ -53,9 +54,15 @@ int selected_setting; /* Used by the callback */ void dec_sound_formatter(char *buffer, int buffer_size, int val, const char * unit) { val = sound_val2phys(selected_setting, val); + char sign = ' '; + if(val < 0) + { + sign = '-'; + val = abs(val); + } int integer = val / 10; int dec = val % 10; - snprintf(buffer, buffer_size, "%d.%d %s", integer, dec, unit); + snprintf(buffer, buffer_size, "%c%d.%d %s", sign, integer, dec, unit); } bool set_sound(const unsigned char * string, @@ -237,6 +244,9 @@ static bool recchannels(void) static bool recquality(void) { +#ifdef HAVE_UDA1380 + (void)recquality(); +#endif return set_int(str(LANG_RECORDING_QUALITY), "", UNIT_INT, &global_settings.rec_quality, NULL, 1, 0, 7, NULL ); @@ -248,21 +258,6 @@ static bool receditable(void) &global_settings.rec_editable); } -#ifdef HAVE_UDA1380 -static bool recadcleft(void) -{ - return set_sound(str(LANG_RECORDING_ADC_LEFT), - &global_settings.rec_adc_left_gain, - SOUND_ADC_LEFT_GAIN); -} - -static bool recadcright(void) -{ - return set_sound(str(LANG_RECORDING_ADC_RIGHT), - &global_settings.rec_adc_right_gain, - SOUND_ADC_RIGHT_GAIN); -} -#endif static bool rectimesplit(void) { @@ -791,8 +786,10 @@ bool recording_menu(bool no_source) struct menu_item items[13]; bool result; +#ifndef HAVE_UDA1380 items[i].desc = ID2P(LANG_RECORDING_QUALITY); items[i++].function = recquality; +#endif items[i].desc = ID2P(LANG_RECORDING_FREQUENCY); items[i++].function = recfrequency; if(!no_source) { @@ -801,14 +798,6 @@ bool recording_menu(bool no_source) } items[i].desc = ID2P(LANG_RECORDING_CHANNELS); items[i++].function = recchannels; - -#ifdef HAVE_UDA1380 - items[i].desc = ID2P(LANG_RECORDING_ADC_LEFT); - items[i++].function = recadcleft; - items[i].desc = ID2P(LANG_RECORDING_ADC_RIGHT); - items[i++].function = recadcright; -#endif - items[i].desc = ID2P(LANG_RECORDING_EDITABLE); items[i++].function = receditable; items[i].desc = ID2P(LANG_RECORD_TIMESPLIT); -- cgit v1.2.3