forked from len0rd/rockbox
Added channel configuration
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2243 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a2b697a748
commit
b10989830c
4 changed files with 107 additions and 14 deletions
|
|
@ -57,6 +57,7 @@ struct user_settings
|
||||||
int loudness; /* loudness eq: 0-100 0=off 100=max */
|
int loudness; /* loudness eq: 0-100 0=off 100=max */
|
||||||
int bass_boost; /* bass boost eq: 0-100 0=off 100=max */
|
int bass_boost; /* bass boost eq: 0-100 0=off 100=max */
|
||||||
int avc; /* auto volume correct: 0=disable, 1=2s 2=4s 3=8s */
|
int avc; /* auto volume correct: 0=disable, 1=2s 2=4s 3=8s */
|
||||||
|
int channel_config; /* Stereo, Mono, Mono left, Mono right */
|
||||||
|
|
||||||
/* device settings */
|
/* device settings */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -185,12 +185,21 @@ static Menu bass_boost(void)
|
||||||
static Menu avc(void)
|
static Menu avc(void)
|
||||||
{
|
{
|
||||||
char* names[] = { "off", "2s ", "4s ", "8s " };
|
char* names[] = { "off", "2s ", "4s ", "8s " };
|
||||||
set_option("[AV decay time]", &global_settings.avc, names, 4 );
|
set_option("AV decay time", &global_settings.avc, names, 4 );
|
||||||
mpeg_sound_set(SOUND_AVC, global_settings.avc);
|
mpeg_sound_set(SOUND_AVC, global_settings.avc);
|
||||||
return MENU_OK;
|
return MENU_OK;
|
||||||
}
|
}
|
||||||
#endif /* ARCHOS_RECORDER */
|
#endif /* ARCHOS_RECORDER */
|
||||||
|
|
||||||
|
static Menu chanconf(void)
|
||||||
|
{
|
||||||
|
char *names[] = {"Stereo ", "Mono ", "Mono Left ", "Mono Right" };
|
||||||
|
set_option("Channel configuration",
|
||||||
|
&global_settings.channel_config, names, 4 );
|
||||||
|
mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config);
|
||||||
|
return MENU_OK;
|
||||||
|
}
|
||||||
|
|
||||||
Menu sound_menu(void)
|
Menu sound_menu(void)
|
||||||
{
|
{
|
||||||
int m;
|
int m;
|
||||||
|
|
@ -200,6 +209,7 @@ Menu sound_menu(void)
|
||||||
{ "Bass", bass },
|
{ "Bass", bass },
|
||||||
{ "Treble", treble },
|
{ "Treble", treble },
|
||||||
{ "Balance", balance },
|
{ "Balance", balance },
|
||||||
|
{ "Channels", chanconf },
|
||||||
#ifdef HAVE_MAS3587F
|
#ifdef HAVE_MAS3587F
|
||||||
{ "Loudness", loudness },
|
{ "Loudness", loudness },
|
||||||
{ "Bass Boost", bass_boost },
|
{ "Bass Boost", bass_boost },
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,9 @@ static char *units[] =
|
||||||
"dB", /* Treble */
|
"dB", /* Treble */
|
||||||
"%", /* Balance */
|
"%", /* Balance */
|
||||||
"dB", /* Loudness */
|
"dB", /* Loudness */
|
||||||
"%" /* Bass boost */
|
"%", /* Bass boost */
|
||||||
|
"", /* AVC */
|
||||||
|
"" /* Channels */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int numdecimals[] =
|
static int numdecimals[] =
|
||||||
|
|
@ -75,7 +77,9 @@ static int numdecimals[] =
|
||||||
0, /* Treble */
|
0, /* Treble */
|
||||||
0, /* Balance */
|
0, /* Balance */
|
||||||
0, /* Loudness */
|
0, /* Loudness */
|
||||||
0 /* Bass boost */
|
0, /* Bass boost */
|
||||||
|
0, /* AVC */
|
||||||
|
0 /* Channels */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int minval[] =
|
static int minval[] =
|
||||||
|
|
@ -85,7 +89,9 @@ static int minval[] =
|
||||||
0, /* Treble */
|
0, /* Treble */
|
||||||
-50, /* Balance */
|
-50, /* Balance */
|
||||||
0, /* Loudness */
|
0, /* Loudness */
|
||||||
0 /* Bass boost */
|
0, /* Bass boost */
|
||||||
|
0, /* AVC */
|
||||||
|
0 /* Channels */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int maxval[] =
|
static int maxval[] =
|
||||||
|
|
@ -100,7 +106,9 @@ static int maxval[] =
|
||||||
#endif
|
#endif
|
||||||
50, /* Balance */
|
50, /* Balance */
|
||||||
17, /* Loudness */
|
17, /* Loudness */
|
||||||
10 /* Bass boost */
|
10, /* Bass boost */
|
||||||
|
0, /* AVC */
|
||||||
|
3 /* Channels */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int defaultval[] =
|
static int defaultval[] =
|
||||||
|
|
@ -115,7 +123,9 @@ static int defaultval[] =
|
||||||
#endif
|
#endif
|
||||||
0, /* Balance */
|
0, /* Balance */
|
||||||
0, /* Loudness */
|
0, /* Loudness */
|
||||||
0 /* Bass boost */
|
0, /* Bass boost */
|
||||||
|
0, /* AVC */
|
||||||
|
0 /* Channels */
|
||||||
};
|
};
|
||||||
|
|
||||||
char *mpeg_sound_unit(int setting)
|
char *mpeg_sound_unit(int setting)
|
||||||
|
|
@ -1603,6 +1613,9 @@ void mpeg_sound_set(int setting, int value)
|
||||||
mas_codec_writereg(MAS_REG_KAVC, tmp);
|
mas_codec_writereg(MAS_REG_KAVC, tmp);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case SOUND_CHANNELS:
|
||||||
|
mpeg_sound_channel_config(value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
}
|
}
|
||||||
|
|
@ -1650,6 +1663,72 @@ int mpeg_val2phys(int setting, int value)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mpeg_sound_channel_config(int configuration)
|
||||||
|
{
|
||||||
|
unsigned long val_on = 0x80000;
|
||||||
|
unsigned long val_off = 0;
|
||||||
|
|
||||||
|
switch(configuration)
|
||||||
|
{
|
||||||
|
case MPEG_SOUND_STEREO:
|
||||||
|
val_on = 0x80000;
|
||||||
|
#ifdef HAVE_MAS3587F
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fd, &val_off, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fe, &val_off, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */
|
||||||
|
#else
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f9, &val_off, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fa, &val_off, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case MPEG_SOUND_MONO:
|
||||||
|
val_on = 0xc0000;
|
||||||
|
#ifdef HAVE_MAS3587F
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fd, &val_on, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fe, &val_on, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */
|
||||||
|
#else
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f9, &val_on, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fa, &val_on, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case MPEG_SOUND_MONO_LEFT:
|
||||||
|
val_on = 0x80000;
|
||||||
|
#ifdef HAVE_MAS3587F
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fc, &val_on, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fd, &val_on, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fe, &val_off, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7ff, &val_off, 1); /* RR */
|
||||||
|
#else
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f8, &val_on, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f9, &val_on, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fa, &val_off, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fb, &val_off, 1); /* RR */
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case MPEG_SOUND_MONO_RIGHT:
|
||||||
|
val_on = 0xc0000;
|
||||||
|
#ifdef HAVE_MAS3587F
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fc, &val_off, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fd, &val_off, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7fe, &val_on, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D0, 0x7ff, &val_on, 1); /* RR */
|
||||||
|
#else
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f8, &val_off, 1); /* LL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7f9, &val_off, 1); /* LR */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fa, &val_on, 1); /* RL */
|
||||||
|
mas_writemem(MAS_BANK_D1, 0x7fb, &val_on, 1); /* RR */
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int bass_boost, int avc)
|
void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int bass_boost, int avc)
|
||||||
{
|
{
|
||||||
#ifdef SIMULATOR
|
#ifdef SIMULATOR
|
||||||
|
|
@ -1676,10 +1755,7 @@ void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int
|
||||||
if(rc < 0)
|
if(rc < 0)
|
||||||
panicf("mas_ctrl_r: %d", rc);
|
panicf("mas_ctrl_r: %d", rc);
|
||||||
|
|
||||||
/* Max volume on both ears */
|
mpeg_sound_channel_config(MPEG_SOUND_STEREO);
|
||||||
val = 0x80000;
|
|
||||||
mas_writemem(MAS_BANK_D0,0x7fc,&val,1);
|
|
||||||
mas_writemem(MAS_BANK_D0,0x7ff,&val,1);
|
|
||||||
|
|
||||||
/* Enable the D/A Converter */
|
/* Enable the D/A Converter */
|
||||||
mas_codec_writereg(0x0, 0x0001);
|
mas_codec_writereg(0x0, 0x0001);
|
||||||
|
|
@ -1755,9 +1831,8 @@ void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int
|
||||||
mas_writereg(MAS_REG_KPRESCALE, 0xe9400);
|
mas_writereg(MAS_REG_KPRESCALE, 0xe9400);
|
||||||
dac_config(0x04); /* DAC on, all else off */
|
dac_config(0x04); /* DAC on, all else off */
|
||||||
|
|
||||||
val = 0x80000;
|
mpeg_sound_channel_config(MPEG_SOUND_STEREO);
|
||||||
mas_writemem(MAS_BANK_D1, 0x7f8, &val, 1);
|
|
||||||
mas_writemem(MAS_BANK_D1, 0x7fb, &val, 1);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mpeg_sound_set(SOUND_BASS, bass);
|
mpeg_sound_set(SOUND_BASS, bass);
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ void mpeg_sound_set(int setting, int value);
|
||||||
int mpeg_sound_min(int setting);
|
int mpeg_sound_min(int setting);
|
||||||
int mpeg_sound_max(int setting);
|
int mpeg_sound_max(int setting);
|
||||||
int mpeg_sound_default(int setting);
|
int mpeg_sound_default(int setting);
|
||||||
|
void mpeg_sound_channel_config(int configuration);
|
||||||
int mpeg_val2phys(int setting, int value);
|
int mpeg_val2phys(int setting, int value);
|
||||||
char *mpeg_sound_unit(int setting);
|
char *mpeg_sound_unit(int setting);
|
||||||
int mpeg_sound_numdecimals(int setting);
|
int mpeg_sound_numdecimals(int setting);
|
||||||
|
|
@ -47,6 +48,12 @@ bool mpeg_has_changed_track(void);
|
||||||
#define SOUND_LOUDNESS 4
|
#define SOUND_LOUDNESS 4
|
||||||
#define SOUND_SUPERBASS 5
|
#define SOUND_SUPERBASS 5
|
||||||
#define SOUND_AVC 6
|
#define SOUND_AVC 6
|
||||||
#define SOUND_NUMSETTINGS 7
|
#define SOUND_CHANNELS 7
|
||||||
|
#define SOUND_NUMSETTINGS 8
|
||||||
|
|
||||||
|
#define MPEG_SOUND_STEREO 0
|
||||||
|
#define MPEG_SOUND_MONO 1
|
||||||
|
#define MPEG_SOUND_MONO_LEFT 2
|
||||||
|
#define MPEG_SOUND_MONO_RIGHT 3
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue