forked from len0rd/rockbox
Iriver: Moved the handling of the UDA1380 split gain (analog preamp + decimator gain) into the UDA driver. * All: Settings structure sorted & cleaned up.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9927 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
c9a1b4e9aa
commit
a238ab9df8
9 changed files with 109 additions and 477 deletions
|
@ -385,18 +385,16 @@ bool radio_screen(void)
|
|||
global_settings.rec_prerecord_time);
|
||||
|
||||
|
||||
audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
||||
sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
|
||||
#else
|
||||
peak_meter_enabled = false;
|
||||
uda1380_enable_recording(false);
|
||||
uda1380_set_recvol(10, 10, AUDIO_GAIN_DECIMATOR);
|
||||
uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN);
|
||||
uda1380_set_monitor(true);
|
||||
|
||||
/* Set the input multiplexer to FM */
|
||||
pcm_rec_mux(1);
|
||||
#endif
|
||||
audio_set_recording_gain(sound_default(SOUND_LEFT_GAIN),
|
||||
sound_default(SOUND_RIGHT_GAIN), AUDIO_GAIN_LINEIN);
|
||||
#endif
|
||||
|
||||
curr_freq = global_settings.last_frequency * FREQ_STEP + MIN_FREQ;
|
||||
|
|
|
@ -155,22 +155,12 @@ static void set_gain(void)
|
|||
{
|
||||
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);
|
||||
#ifdef HAVE_UDA1380
|
||||
audio_set_recording_gain(global_settings.rec_linein_decimator_left_gain,
|
||||
global_settings.rec_linein_decimator_right_gain,
|
||||
AUDIO_GAIN_DECIMATOR);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,13 +175,13 @@ char *fmt_gain(int snd, int val, char *str, int len)
|
|||
{
|
||||
int i, d, numdec;
|
||||
const char *unit;
|
||||
char sign = ' ';
|
||||
|
||||
val = sound_val2phys(snd, val);
|
||||
char sign = ' ';
|
||||
if(val < 0)
|
||||
{
|
||||
sign = '-';
|
||||
val = abs(val);
|
||||
val = -val;
|
||||
}
|
||||
numdec = sound_numdecimals(snd);
|
||||
unit = sound_unit(snd);
|
||||
|
@ -208,34 +198,6 @@ char *fmt_gain(int snd, int val, char *str, int len)
|
|||
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;
|
||||
}
|
||||
|
||||
static int cursor;
|
||||
|
||||
void adjust_cursor(void)
|
||||
|
@ -351,158 +313,6 @@ 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;
|
||||
|
@ -525,22 +335,6 @@ bool recording_screen(void)
|
|||
#endif
|
||||
int i;
|
||||
|
||||
#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),
|
||||
|
@ -789,20 +583,6 @@ 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)
|
||||
{
|
||||
|
@ -830,7 +610,6 @@ bool recording_screen(void)
|
|||
sound_max(SOUND_RIGHT_GAIN))
|
||||
global_settings.rec_right_gain++;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
set_gain();
|
||||
update_countdown = 1; /* Update immediately */
|
||||
|
@ -850,23 +629,6 @@ 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)
|
||||
{
|
||||
|
@ -894,7 +656,6 @@ bool recording_screen(void)
|
|||
sound_min(SOUND_RIGHT_GAIN))
|
||||
global_settings.rec_right_gain--;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
set_gain();
|
||||
update_countdown = 1; /* Update immediately */
|
||||
|
@ -1097,40 +858,10 @@ bool recording_screen(void)
|
|||
|
||||
if(global_settings.rec_source == SOURCE_MIC)
|
||||
{
|
||||
#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)));
|
||||
#endif
|
||||
if(global_settings.invert_cursor && ((1==cursor)||(2==cursor)))
|
||||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
|
@ -1145,44 +876,11 @@ bool recording_screen(void)
|
|||
}
|
||||
else if(global_settings.rec_source == SOURCE_LINE)
|
||||
{
|
||||
#ifdef HAVE_UDA1380
|
||||
|
||||
/*****************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)))
|
||||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
|
@ -1195,32 +893,11 @@ bool recording_screen(void)
|
|||
screens[i].puts(0, 3+PM_HEIGHT, 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)))
|
||||
{
|
||||
FOR_NB_SCREENS(i)
|
||||
|
@ -1266,14 +943,14 @@ bool recording_screen(void)
|
|||
}
|
||||
}
|
||||
/* Can't measure S/PDIF sample rate on Archos yet */
|
||||
#if CONFIG_CODEC != MAS3587F && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
|
||||
#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
|
||||
if (global_settings.rec_source == SOURCE_SPDIF)
|
||||
snprintf(spdif_sfreq, 8, "%dHz", audio_get_spdif_sample_rate());
|
||||
#else
|
||||
(void)spdif_sfreq;
|
||||
#endif
|
||||
snprintf(buf, 32, "%s %s",
|
||||
#if CONFIG_CODEC != MAS3587F && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
|
||||
#if (CONFIG_CODEC != MAS3587F) && defined(HAVE_SPDIF_IN) && !defined(SIMULATOR)
|
||||
global_settings.rec_source == SOURCE_SPDIF ?
|
||||
spdif_sfreq :
|
||||
#endif
|
||||
|
|
184
apps/settings.c
184
apps/settings.c
|
@ -94,7 +94,7 @@ const char rec_base_directory[] = REC_BASE_DIR;
|
|||
#include "dsp.h"
|
||||
#endif
|
||||
|
||||
#define CONFIG_BLOCK_VERSION 42
|
||||
#define CONFIG_BLOCK_VERSION 43
|
||||
#define CONFIG_BLOCK_SIZE 512
|
||||
#define RTC_BLOCK_SIZE 44
|
||||
|
||||
|
@ -342,20 +342,47 @@ static const struct bit_entry hd_bits[] =
|
|||
#ifdef CONFIG_BACKLIGHT
|
||||
{1, S_O(caption_backlight), false, "caption backlight", off_on },
|
||||
#endif
|
||||
{4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
#if LCD_WIDTH > 127
|
||||
{8, S_O(scroll_step), 6, "scroll step", NULL }, /* 1...160 */
|
||||
#else
|
||||
{7, S_O(scroll_step), 6, "scroll step", NULL }, /* 1...112 */
|
||||
#ifdef HAVE_REMOTE_LCD
|
||||
{1, S_O(remote_caption_backlight), false,
|
||||
"remote caption backlight", off_on },
|
||||
#endif
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
{4, S_O(brightness), 9, "brightness", NULL },
|
||||
#endif
|
||||
#ifdef HAVE_BACKLIGHT_PWM_FADING
|
||||
/* backlight fading */
|
||||
{2, S_O(backlight_fade_in), 1, "backlight fade in", "off,500ms,1s,2s"},
|
||||
{3, S_O(backlight_fade_out), 3, "backlight fade out",
|
||||
"off,500ms,1s,2s,3s,4s,5s,10s"},
|
||||
#endif
|
||||
|
||||
{4, S_O(scroll_speed), 9, "scroll speed", NULL }, /* 0...15 */
|
||||
{8, S_O(scroll_delay), 100, "scroll delay", NULL }, /* 0...250 */
|
||||
{8, S_O(bidir_limit), 50, "bidir limit", NULL }, /* 0...200 */
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
{1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on },
|
||||
#if LCD_WIDTH > 255
|
||||
{9, S_O(scroll_step), 6, "scroll step", NULL },
|
||||
{9, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
|
||||
#elif LCD_WIDTH > 127
|
||||
{8, S_O(scroll_step), 6, "scroll step", NULL },
|
||||
{8, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
|
||||
#else
|
||||
{7, S_O(scroll_step), 6, "scroll step", NULL },
|
||||
{7, S_O(screen_scroll_step), 16, "screen scroll step", NULL },
|
||||
#endif
|
||||
#endif /* HAVE_LCD_BITMAP */
|
||||
#ifdef HAVE_LCD_CHARCELLS
|
||||
{3, S_O(jump_scroll), 0, "jump scroll", NULL }, /* 0...5 */
|
||||
{8, S_O(jump_scroll_delay), 50, "jump scroll delay", NULL }, /* 0...250 */
|
||||
#endif
|
||||
{1, S_O(scroll_paginated), false, "scroll paginated", off_on },
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
{LCD_DEPTH,S_O(fg_color),LCD_DEFAULT_FG,"foreground color","rgb"},
|
||||
{LCD_DEPTH,S_O(bg_color),LCD_DEFAULT_BG,"background color","rgb"},
|
||||
#endif
|
||||
|
||||
/* more playback */
|
||||
{1, S_O(play_selected), true, "play selected", off_on },
|
||||
{1, S_O(fade_on_stop), true, "volume fade", off_on },
|
||||
|
@ -375,6 +402,7 @@ static const struct bit_entry hd_bits[] =
|
|||
#endif
|
||||
{8, S_O(disk_spindown), 5, "disk spindown", NULL },
|
||||
#endif /* HAVE_MMC */
|
||||
|
||||
/* browser */
|
||||
{3, S_O(dirfilter), SHOW_SUPPORTED,
|
||||
"show files", "all,supported,music,playlists,id3 database" },
|
||||
|
@ -406,29 +434,6 @@ static const struct bit_entry hd_bits[] =
|
|||
{7, S_O(peak_meter_min), 60, "peak meter min", NULL }, /* 0...100 */
|
||||
{7, S_O(peak_meter_max), 0, "peak meter max", NULL }, /* 0...100 */
|
||||
#endif
|
||||
#if CONFIG_CODEC == MAS3587F
|
||||
/* recording */
|
||||
{1, S_O(rec_editable), false, "editable recordings", off_on },
|
||||
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
|
||||
"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" },
|
||||
{1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
|
||||
{4, S_O(rec_mic_gain), 8, "rec mic gain", NULL },
|
||||
{3, S_O(rec_quality), 5, "rec quality", NULL },
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
{2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
|
||||
#else
|
||||
{1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
|
||||
#endif
|
||||
{3, S_O(rec_frequency), 0, /* 0=44.1kHz */
|
||||
"rec frequency", "44,48,32,22,24,16" },
|
||||
{4, S_O(rec_left_gain), 2, /* 0dB */
|
||||
"rec left gain", NULL }, /* 0...15 */
|
||||
{4, S_O(rec_right_gain), 2, /* 0dB */
|
||||
"rec right gain", NULL }, /* 0...15 */
|
||||
{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" },
|
||||
#endif
|
||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||
{7, S_O(mdb_strength), 0, "mdb strength", NULL},
|
||||
{7, S_O(mdb_harmonics), 0, "mdb harmonics", NULL},
|
||||
|
@ -449,7 +454,37 @@ static const struct bit_entry hd_bits[] =
|
|||
{1, S_O(id3_v1_first), 0, "id3 tag priority", "v2-v1,v1-v2"},
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
/* recording */
|
||||
{1, S_O(rec_startup), false, "rec screen on startup", off_on },
|
||||
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
|
||||
"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" },
|
||||
{1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
{2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
|
||||
#else
|
||||
{1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
|
||||
#endif
|
||||
{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" },
|
||||
#ifdef CONFIG_BACKLIGHT
|
||||
{2, S_O(cliplight), 0, "cliplight", "off,main,both,remote" },
|
||||
#endif
|
||||
#if CONFIG_CODEC == MAS3587F
|
||||
{4, S_O(rec_mic_gain), 8, "rec mic gain", NULL },
|
||||
{4, S_O(rec_left_gain), 2 /* 0dB */, "rec left gain", NULL }, /* 0...15 */
|
||||
{4, S_O(rec_right_gain), 2 /* 0dB */, "rec right gain", NULL }, /* 0...15 */
|
||||
{3, S_O(rec_frequency), 0, /* 0=44.1kHz */
|
||||
"rec frequency", "44,48,32,22,24,16" },
|
||||
{1, S_O(rec_editable), false, "editable recordings", off_on },
|
||||
{3, S_O(rec_quality), 5, "rec quality", NULL },
|
||||
#elif defined(HAVE_UDA1380)
|
||||
{8|SIGNED, S_O(rec_mic_gain), 16 /* 8 dB */, "rec mic gain", NULL }, /* -128...+108 */
|
||||
{8|SIGNED, S_O(rec_left_gain), 0, "rec left gain", NULL }, /* -128...+96 */
|
||||
{8|SIGNED, S_O(rec_right_gain), 0, "rec right gain", NULL }, /* -128...+96 */
|
||||
{3, S_O(rec_frequency), 0, /* 0=44.1kHz */
|
||||
"rec frequency", "44,48,32,22,24,16" },
|
||||
#endif
|
||||
|
||||
/* values for the trigger */
|
||||
{8 | SIGNED, S_O(rec_start_thres), -35, "trigger start threshold", NULL},
|
||||
|
@ -458,14 +493,7 @@ static const struct bit_entry hd_bits[] =
|
|||
{4, S_O(rec_stop_postrec), 2, "trigger stop postrec", trig_durations_conf},
|
||||
{4, S_O(rec_stop_gap), 1, "trigger min gap", trig_durations_conf},
|
||||
{4, S_O(rec_trigger_mode ), 0, "trigger mode", "off,once,repeat"},
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_PWM_FADING
|
||||
/* backlight fading */
|
||||
{2, S_O(backlight_fade_in), 1, "backlight fade in", "off,500ms,1s,2s"},
|
||||
{3, S_O(backlight_fade_out), 3, "backlight fade out",
|
||||
"off,500ms,1s,2s,3s,4s,5s,10s"},
|
||||
#endif
|
||||
#endif /* HAVE_RECORDING */
|
||||
|
||||
#ifdef HAVE_SPDIF_POWER
|
||||
{1, S_O(spdif_enable), false, "spdif enable", off_on},
|
||||
|
@ -492,59 +520,8 @@ static const struct bit_entry hd_bits[] =
|
|||
{7, S_O(crossfeed_cross_gain), 60, "crossfeed cross gain", NULL },
|
||||
{8, S_O(crossfeed_hf_attenuation), 160, "crossfeed hf attenuation", NULL },
|
||||
{11, S_O(crossfeed_hf_cutoff), 700, "crossfeed hf cutoff", NULL },
|
||||
#endif
|
||||
#ifdef HAVE_DIRCACHE
|
||||
{1, S_O(dircache), false, "dircache", off_on },
|
||||
{22, S_O(dircache_size), 0, NULL, NULL },
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_UDA1380)
|
||||
/* recording settings for iriver */
|
||||
{4, S_O(rec_timesplit), 0, "rec timesplit", /* 0...15 */
|
||||
"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" },
|
||||
{1, S_O(rec_channels), 0, "rec channels", "stereo,mono" },
|
||||
{4, S_O(rec_mic_gain), 4, "rec mic gain", NULL },
|
||||
#ifdef HAVE_SPDIF_IN
|
||||
{2, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line,spdif" },
|
||||
#else
|
||||
{1, S_O(rec_source), 0 /* 0=mic */, "rec source", "mic,line" },
|
||||
#endif
|
||||
{3, S_O(rec_frequency), 0, /* 0=44.1kHz */
|
||||
"rec frequency", "44,48,32,22,24,16" },
|
||||
{4, S_O(rec_left_gain), 2, /* 0dB */
|
||||
"rec left gain", NULL }, /* 0...15 */
|
||||
{4, S_O(rec_right_gain), 2, /* 0dB */
|
||||
"rec right gain", NULL }, /* 0...15 */
|
||||
{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_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
|
||||
{1, S_O(remote_caption_backlight), false,
|
||||
"remote caption backlight", off_on },
|
||||
#endif
|
||||
{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" },
|
||||
|
||||
#ifdef HAVE_BACKLIGHT_BRIGHTNESS
|
||||
{4, S_O(brightness), 9, "brightness", NULL },
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
{1, S_O(offset_out_of_view), false, "Screen Scrolls Out Of View", off_on },
|
||||
#if LCD_WIDTH > 127
|
||||
{8, S_O(screen_scroll_step), 16, "screen scroll step", NULL }, /* 1...160 */
|
||||
#else
|
||||
{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
|
||||
/* equalizer */
|
||||
{1, S_O(eq_enabled), false, "eq enabled", off_on },
|
||||
{8, S_O(eq_precut), 0, "eq precut", NULL },
|
||||
/* 0..32768 Hz */
|
||||
|
@ -566,28 +543,19 @@ 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
|
||||
{1, S_O(scroll_paginated), false, "scroll paginated", off_on },
|
||||
#ifdef HAVE_RECORDING
|
||||
#ifdef CONFIG_BACKLIGHT
|
||||
{2, S_O(cliplight), 0, "cliplight", "off,main,both,remote" },
|
||||
#endif /* CONFIG_BACKLIGHT */
|
||||
#endif /*HAVE_RECORDING*/
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
{LCD_DEPTH,S_O(fg_color),LCD_DEFAULT_FG,"foreground color","rgb"},
|
||||
{LCD_DEPTH,S_O(bg_color),LCD_DEFAULT_BG,"background color","rgb"},
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DIRCACHE
|
||||
{1, S_O(dircache), false, "dircache", off_on },
|
||||
{22, S_O(dircache_size), 0, NULL, NULL },
|
||||
{1, S_O(tagcache_ram), 0, "tagcache_ram", off_on },
|
||||
#endif
|
||||
|
||||
{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" },
|
||||
|
||||
{1, S_O(warnon_erase_dynplaylist), false,
|
||||
"warn when erasing dynamic playlist", off_on },
|
||||
|
||||
/* If values are just added to the end, no need to bump the version. */
|
||||
/* new stuff to be added at the end */
|
||||
|
||||
|
|
|
@ -229,12 +229,6 @@ struct user_settings
|
|||
int rec_mic_gain; /* 0-15 */
|
||||
int rec_left_gain; /* 0-15 */
|
||||
int rec_right_gain; /* 0-15 */
|
||||
#ifdef HAVE_UDA1380
|
||||
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 */
|
||||
|
||||
/* note: timesplit setting is not saved */
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "file.h"
|
||||
#include "buffer.h"
|
||||
#include "audio.h"
|
||||
#include "logf.h"
|
||||
|
||||
#include "i2c-coldfire.h"
|
||||
#include "uda1380.h"
|
||||
|
@ -255,27 +256,37 @@ void uda1380_disable_recording(void)
|
|||
/**
|
||||
* Set recording gain and volume
|
||||
*
|
||||
* type: params: ranges:
|
||||
* AUDIO_GAIN_MIC left 0 .. 15 -> 0 .. 30 dB gain
|
||||
* AUDIO_GAIN_LINEIN left & right 0 .. 8 -> 0 .. 24 dB gain
|
||||
* AUDIO_GAIN_DECIMATOR left & right -128 .. 48 -> -64 .. 24 dB gain
|
||||
* type: params: ranges:
|
||||
* AUDIO_GAIN_MIC: left -128 .. 108 -> -64 .. 54 dB gain
|
||||
* AUDIO_GAIN_LINEIN left & right -128 .. 96 -> -64 .. 48 dB gain
|
||||
*
|
||||
* Note: For all types the value 0 gives 0 dB gain.
|
||||
*/
|
||||
void uda1380_set_recvol(int left, int right, int type)
|
||||
{
|
||||
int left_ag, right_ag;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case AUDIO_GAIN_MIC:
|
||||
uda1380_write_reg(REG_ADC, (uda1380_regs[REG_ADC] & ~VGA_GAIN_MASK) | VGA_GAIN(left));
|
||||
left_ag = MIN(MAX(0, left / 4), 15);
|
||||
left -= left_ag * 4;
|
||||
uda1380_write_reg(REG_ADC, (uda1380_regs[REG_ADC] & ~VGA_GAIN_MASK)
|
||||
| VGA_GAIN(left_ag));
|
||||
uda1380_write_reg(REG_DEC_VOL, DEC_VOLL(left) | DEC_VOLR(left));
|
||||
logf("Mic: %dA/%dD", left_ag, left);
|
||||
break;
|
||||
|
||||
case AUDIO_GAIN_LINEIN:
|
||||
uda1380_write_reg(REG_PGA, (uda1380_regs[REG_PGA] & ~PGA_GAIN_MASK) | PGA_GAINL(left) | PGA_GAINR(right));
|
||||
break;
|
||||
|
||||
case AUDIO_GAIN_DECIMATOR:
|
||||
left_ag = MIN(MAX(0, left / 6), 8);
|
||||
left -= left_ag * 6;
|
||||
right_ag = MIN(MAX(0, right / 6), 8);
|
||||
right -= right_ag * 6;
|
||||
uda1380_write_reg(REG_PGA, (uda1380_regs[REG_PGA] & ~PGA_GAIN_MASK)
|
||||
| PGA_GAINL(left_ag) | PGA_GAINR(right_ag));
|
||||
uda1380_write_reg(REG_DEC_VOL, DEC_VOLL(left) | DEC_VOLR(right));
|
||||
logf("Line L: %dA/%dD", left_ag, left);
|
||||
logf("Line R: %dA/%dD", right_ag, right);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@
|
|||
|
||||
#define AUDIO_GAIN_LINEIN 0
|
||||
#define AUDIO_GAIN_MIC 1
|
||||
#define AUDIO_GAIN_DECIMATOR 2 /* for UDA1380 */
|
||||
|
||||
|
||||
struct audio_debug
|
||||
|
|
|
@ -41,10 +41,6 @@ enum {
|
|||
SOUND_RIGHT_GAIN,
|
||||
SOUND_MIC_GAIN,
|
||||
#endif
|
||||
#if defined(HAVE_UDA1380)
|
||||
SOUND_DECIMATOR_LEFT_GAIN,
|
||||
SOUND_DECIMATOR_RIGHT_GAIN,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
@ -348,12 +348,11 @@ void audio_set_recording_options(int frequency, int quality,
|
|||
* Note that microphone is mono, only left value is used
|
||||
* See uda1380_set_recvol() for exact ranges.
|
||||
*
|
||||
* @param type 0=line-in (radio), 1=mic, 2=ADC
|
||||
* @param type 0=line-in (radio), 1=mic
|
||||
*
|
||||
*/
|
||||
void audio_set_recording_gain(int left, int right, int type)
|
||||
{
|
||||
//logf("rcmrec: t=%d l=%d r=%d", type, left, right);
|
||||
uda1380_set_recvol(left, right, type);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,11 +108,9 @@ static const struct sound_settings_info sound_settings_table[] = {
|
|||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 15, 8, NULL},
|
||||
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL},
|
||||
#elif defined(HAVE_UDA1380)
|
||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1, 0, 8, 8, NULL},
|
||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1, 0, 8, 8, NULL},
|
||||
[SOUND_MIC_GAIN] = {"dB", 1, 1, 0, 15, 2, NULL},
|
||||
[SOUND_DECIMATOR_LEFT_GAIN] = {"dB", 1, 1,-128, 48, 0, NULL},
|
||||
[SOUND_DECIMATOR_RIGHT_GAIN]= {"dB", 1, 1,-128, 48, 0, NULL},
|
||||
[SOUND_LEFT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
||||
[SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0, NULL},
|
||||
[SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16, NULL},
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -894,19 +892,11 @@ int sound_val2phys(int setting, int value)
|
|||
{
|
||||
case SOUND_LEFT_GAIN:
|
||||
case SOUND_RIGHT_GAIN:
|
||||
result = value * 30; /* (24/8) *10 */
|
||||
break;
|
||||
|
||||
case SOUND_MIC_GAIN:
|
||||
result = value * 20; /* (30/15) *10 */
|
||||
result = value * 5; /* (1/2) * 10 */
|
||||
break;
|
||||
|
||||
case SOUND_DECIMATOR_LEFT_GAIN:
|
||||
case SOUND_DECIMATOR_RIGHT_GAIN:
|
||||
result = value * 5; /* (1/2) *10 */
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
result = value;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue