Bass boost removed in favour of some new sound settings: Super bass and five new MDB parameters: strength, harmonics, center, shape and enable

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4839 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2004-07-06 12:17:14 +00:00
parent 012c541d80
commit 7bade1a24f
9 changed files with 291 additions and 89 deletions

View file

@ -326,9 +326,9 @@ voice: "Loudness"
new:
id: LANG_BBOOST
desc: in sound settings
eng: "Bass Boost"
voice: "Bass Boost"
desc: DEPRECATED
eng: ""
voice: ""
new:
id: LANG_DECAY
@ -2757,3 +2757,39 @@ desc: in radio screen
eng: "Action"
voice: ""
new:
id: LANG_MDB_STRENGTH
desc: in sound settings
eng: "MDB Strength"
voice: "MDB Strength"
new:
id: LANG_MDB_HARMONICS
desc: in sound settings
eng: "MDB Harmonics"
voice: "MDB Harmonics"
new:
id: LANG_MDB_CENTER
desc: in sound settings
eng: "MDB Center frequency"
voice: "MDB Center frequency"
new:
id: LANG_MDB_SHAPE
desc: in sound settings
eng: "MDB Shape"
voice: "MDB Shape"
new:
id: LANG_MDB_ENABLE
desc: in sound settings
eng: "MDB Enable"
voice: "MDB Enable"
new:
id: LANG_SUPERBASS
desc: in sound settings
eng: "Super bass"
voice: "Super bass"
new:

View file

@ -89,9 +89,14 @@ void init(void)
global_settings.treble,
global_settings.balance,
global_settings.loudness,
global_settings.bass_boost,
global_settings.avc,
global_settings.channel_config );
global_settings.channel_config,
global_settings.mdb_strength,
global_settings.mdb_harmonics,
global_settings.mdb_center,
global_settings.mdb_shape,
global_settings.mdb_enable,
global_settings.superbass);
mpeg_init();
while (button_get(false) != 0)
; /* Empty the keyboard buffer */
@ -227,9 +232,14 @@ void init(void)
global_settings.treble,
global_settings.balance,
global_settings.loudness,
global_settings.bass_boost,
global_settings.avc,
global_settings.channel_config );
global_settings.channel_config,
global_settings.mdb_strength,
global_settings.mdb_harmonics,
global_settings.mdb_center,
global_settings.mdb_shape,
global_settings.mdb_enable,
global_settings.superbass);
mpeg_init();
talk_init();

View file

@ -203,14 +203,7 @@ bool radio_screen(void)
mpeg_init_recording();
mpeg_sound_channel_config(global_settings.channel_config);
mpeg_sound_set(SOUND_BASS, global_settings.bass);
mpeg_sound_set(SOUND_TREBLE, global_settings.treble);
mpeg_sound_set(SOUND_BALANCE, global_settings.balance);
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness);
mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost);
mpeg_sound_set(SOUND_AVC, global_settings.avc);
sound_settings_apply();
/* Yes, we use the D/A for monitoring */
peak_meter_playback(true);
@ -532,14 +525,7 @@ bool radio_screen(void)
mpeg_init_playback();
mpeg_sound_channel_config(global_settings.channel_config);
mpeg_sound_set(SOUND_BASS, global_settings.bass);
mpeg_sound_set(SOUND_TREBLE, global_settings.treble);
mpeg_sound_set(SOUND_BALANCE, global_settings.balance);
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness);
mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost);
mpeg_sound_set(SOUND_AVC, global_settings.avc);
sound_settings_apply();
fmradio_set_status(0);

View file

@ -606,14 +606,7 @@ bool recording_screen(void)
mpeg_init_playback();
mpeg_sound_channel_config(global_settings.channel_config);
mpeg_sound_set(SOUND_BASS, global_settings.bass);
mpeg_sound_set(SOUND_TREBLE, global_settings.treble);
mpeg_sound_set(SOUND_BALANCE, global_settings.balance);
mpeg_sound_set(SOUND_VOLUME, global_settings.volume);
mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness);
mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost);
mpeg_sound_set(SOUND_AVC, global_settings.avc);
sound_settings_apply();
lcd_setfont(FONT_UI);

View file

@ -71,7 +71,7 @@ char rockboxdir[] = ROCKBOX_DIR; /* config/font/data file directory */
char rec_base_directory[] = REC_BASE_DIR;
#define CONFIG_BLOCK_VERSION 13
#define CONFIG_BLOCK_VERSION 14
#define CONFIG_BLOCK_SIZE 512
#define RTC_BLOCK_SIZE 44
@ -165,8 +165,8 @@ static struct bit_entry rtc_bits[] =
{5 | SIGNED, S_O(treble), 0, "treble", NULL }, /* -15..+15 / -12..+12 */
#ifdef HAVE_MAS3587F
{5, S_O(loudness), 0, "loudness", NULL }, /* 0...17 */
{7, S_O(bass_boost), 0, "bass boost", NULL }, /* 0...100 */
{3, S_O(avc), 0, "auto volume", "off,20ms,2,4,8" },
{1, S_O(superbass), false, "superbass", off_on },
#endif
{3, S_O(channel_config), 6, "channels",
"stereo,stereo narrow,mono,mono left,mono right,karaoke,stereo wide" },
@ -325,7 +325,11 @@ static struct bit_entry hd_bits[] =
/* If values are just added to the end, no need to bump the version. */
{2, S_O(sort_file), 0, "sort files", "alpha,oldest,newest,type" },
{2, S_O(sort_dir), 0, "sort dirs", "alpha,oldest,newest" },
{7, S_O(mdb_strength), 0, "mdb strength", NULL},
{7, S_O(mdb_harmonics), 0, "mdb harmonics", NULL},
{9, S_O(mdb_center), 0, "mdb center", NULL},
{9, S_O(mdb_shape), 0, "mdb shape", NULL},
{1, S_O(mdb_enable), 0, "mdb enable", off_on},
/* Sum of all bit sizes must not grow beyond 0xB8*8 = 1472 */
};
@ -667,10 +671,8 @@ void settings_apply_pm_range(void)
}
#endif /* HAVE_LCD_BITMAP */
void settings_apply(void)
void sound_settings_apply(void)
{
char buf[64];
mpeg_sound_set(SOUND_BASS, global_settings.bass);
mpeg_sound_set(SOUND_TREBLE, global_settings.treble);
mpeg_sound_set(SOUND_BALANCE, global_settings.balance);
@ -678,9 +680,21 @@ void settings_apply(void)
mpeg_sound_set(SOUND_CHANNELS, global_settings.channel_config);
#ifdef HAVE_MAS3587F
mpeg_sound_set(SOUND_LOUDNESS, global_settings.loudness);
mpeg_sound_set(SOUND_SUPERBASS, global_settings.bass_boost);
mpeg_sound_set(SOUND_AVC, global_settings.avc);
mpeg_sound_set(SOUND_MDB_STRENGTH, global_settings.mdb_strength);
mpeg_sound_set(SOUND_MDB_HARMONICS, global_settings.mdb_harmonics);
mpeg_sound_set(SOUND_MDB_CENTER, global_settings.mdb_center);
mpeg_sound_set(SOUND_MDB_SHAPE, global_settings.mdb_shape);
mpeg_sound_set(SOUND_MDB_ENABLE, global_settings.mdb_enable);
mpeg_sound_set(SOUND_SUPERBASS, global_settings.superbass);
#endif
}
void settings_apply(void)
{
char buf[64];
sound_settings_apply();
mpeg_set_buffer_margin(global_settings.buffer_margin);
@ -1207,9 +1221,14 @@ void settings_reset(void) {
global_settings.bass = mpeg_sound_default(SOUND_BASS);
global_settings.treble = mpeg_sound_default(SOUND_TREBLE);
global_settings.loudness = mpeg_sound_default(SOUND_LOUDNESS);
global_settings.bass_boost = mpeg_sound_default(SOUND_SUPERBASS);
global_settings.avc = mpeg_sound_default(SOUND_AVC);
global_settings.channel_config = mpeg_sound_default(SOUND_CHANNELS);
global_settings.mdb_strength = mpeg_sound_default(SOUND_MDB_STRENGTH);
global_settings.mdb_harmonics = mpeg_sound_default(SOUND_MDB_HARMONICS);
global_settings.mdb_center = mpeg_sound_default(SOUND_MDB_CENTER);
global_settings.mdb_shape = mpeg_sound_default(SOUND_MDB_SHAPE);
global_settings.mdb_enable = mpeg_sound_default(SOUND_MDB_ENABLE);
global_settings.superbass = mpeg_sound_default(SOUND_SUPERBASS);
global_settings.contrast = lcd_default_contrast();
global_settings.wps_file[0] = '\0';
global_settings.font_file[0] = '\0';

View file

@ -71,9 +71,14 @@ struct user_settings
int bass; /* bass eq: 0-100 0=off 100=max */
int treble; /* treble eq: 0-100 0=low 100=high */
int loudness; /* loudness 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=off, 1=20ms, 2=2s 3=4s 4=8s */
int channel_config; /* Stereo, Mono, Mono left, Mono right */
int mdb_strength; /* 0-127dB */
int mdb_harmonics; /* 0-100% */
int mdb_center; /* 20-300Hz */
int mdb_shape; /* 50-300Hz */
bool mdb_enable; /* true/false */
bool superbass; /* true/false */
int rec_quality; /* 0-7 */
int rec_source; /* 0=mic, 1=line, 2=S/PDIF */
@ -226,6 +231,7 @@ struct opt_items {
int settings_save(void);
void settings_load(int which);
void settings_reset(void);
void sound_settings_apply(void);
void settings_apply(void);
void settings_apply_pm_range(void);
void settings_display(void);

View file

@ -55,9 +55,11 @@ bool set_sound(char* string,
char* unit;
char str[32];
int talkunit = UNIT_INT;
int steps;
unit = mpeg_sound_unit(setting);
numdec = mpeg_sound_numdecimals(setting);
steps = mpeg_sound_steps(setting);
min = mpeg_sound_min(setting);
max = mpeg_sound_max(setting);
if (*unit == 'd') /* crude reconstruction */
@ -103,7 +105,7 @@ bool set_sound(char* string,
case BUTTON_RIGHT:
case BUTTON_RIGHT | BUTTON_REPEAT:
#endif
(*variable)++;
(*variable)+=steps;
if(*variable > max )
*variable = max;
changed = true;
@ -116,7 +118,7 @@ bool set_sound(char* string,
case BUTTON_LEFT:
case BUTTON_LEFT | BUTTON_REPEAT:
#endif
(*variable)--;
(*variable)-=steps;
if(*variable < min )
*variable = min;
changed = true;
@ -176,10 +178,56 @@ static bool loudness(void)
SOUND_LOUDNESS);
}
static bool bass_boost(void)
static bool mdb_strength(void)
{
return set_sound(str(LANG_BBOOST), &global_settings.bass_boost,
SOUND_SUPERBASS);
return set_sound(str(LANG_MDB_STRENGTH), &global_settings.mdb_strength,
SOUND_MDB_STRENGTH);
}
static bool mdb_harmonics(void)
{
return set_sound(str(LANG_MDB_HARMONICS), &global_settings.mdb_harmonics,
SOUND_MDB_HARMONICS);
}
static bool mdb_center(void)
{
return set_sound(str(LANG_MDB_CENTER), &global_settings.mdb_center,
SOUND_MDB_CENTER);
}
static bool mdb_shape(void)
{
return set_sound(str(LANG_MDB_SHAPE), &global_settings.mdb_shape,
SOUND_MDB_SHAPE);
}
static void set_mdb_enable(bool value)
{
mpeg_sound_set(SOUND_MDB_ENABLE, (int)value);
}
static bool mdb_enable(void)
{
return set_bool_options(str(LANG_MDB_ENABLE),
&global_settings.mdb_enable,
STR(LANG_SET_BOOL_YES),
STR(LANG_SET_BOOL_NO),
set_mdb_enable);
}
static void set_superbass(bool value)
{
mpeg_sound_set(SOUND_SUPERBASS, (int)value);
}
static bool superbass(void)
{
return set_bool_options(str(LANG_SUPERBASS),
&global_settings.superbass,
STR(LANG_SET_BOOL_YES),
STR(LANG_SET_BOOL_NO),
set_superbass);
}
static void set_avc(int val)
@ -363,8 +411,13 @@ bool sound_menu(void)
{ STR(LANG_CHANNEL_MENU), chanconf },
#ifdef HAVE_MAS3587F
{ STR(LANG_LOUDNESS), loudness },
{ STR(LANG_BBOOST), bass_boost },
{ STR(LANG_AUTOVOL), avc }
{ STR(LANG_AUTOVOL), avc },
{ STR(LANG_SUPERBASS), superbass },
{ STR(LANG_MDB_ENABLE), mdb_enable },
{ STR(LANG_MDB_STRENGTH), mdb_strength },
{ STR(LANG_MDB_HARMONICS), mdb_harmonics },
{ STR(LANG_MDB_CENTER), mdb_center },
{ STR(LANG_MDB_SHAPE), mdb_shape },
#endif
};

View file

@ -26,7 +26,10 @@
/* functions formerly in mpeg.c */
void mp3_init(int volume, int bass, int treble, int balance,
int loudness, int bass_boost, int avc, int channel_config);
int loudness, int avc, int channel_config,
int mdb_strength, int mdb_harmonics,
int mdb_center, int mdb_shape, bool mdb_enable,
bool superbass);
void mpeg_sound_set(int setting, int value);
int mpeg_sound_min(int setting);
int mpeg_sound_max(int setting);
@ -35,6 +38,7 @@ void mpeg_sound_channel_config(int configuration);
int mpeg_val2phys(int setting, int value);
char *mpeg_sound_unit(int setting);
int mpeg_sound_numdecimals(int setting);
int mpeg_sound_steps(int setting);
#if defined(HAVE_MAS3587F) || defined(SIMULATOR)
void mpeg_set_pitch(int percent);
#endif
@ -63,13 +67,18 @@ unsigned char* mp3_get_pos(void);
#define SOUND_TREBLE 2
#define SOUND_BALANCE 3
#define SOUND_LOUDNESS 4
#define SOUND_SUPERBASS 5
#define SOUND_AVC 6
#define SOUND_CHANNELS 7
#define SOUND_LEFT_GAIN 8
#define SOUND_RIGHT_GAIN 9
#define SOUND_MIC_GAIN 10
#define SOUND_NUMSETTINGS 11
#define SOUND_AVC 5
#define SOUND_CHANNELS 6
#define SOUND_LEFT_GAIN 7
#define SOUND_RIGHT_GAIN 8
#define SOUND_MIC_GAIN 9
#define SOUND_MDB_STRENGTH 10
#define SOUND_MDB_HARMONICS 11
#define SOUND_MDB_CENTER 12
#define SOUND_MDB_SHAPE 13
#define SOUND_MDB_ENABLE 14
#define SOUND_SUPERBASS 15
#define SOUND_NUMSETTINGS 16
#define MPEG_SOUND_STEREO 0
#define MPEG_SOUND_STEREO_NARROW 1

View file

@ -68,12 +68,17 @@ static char *units[] =
"dB", /* Treble */
"%", /* Balance */
"dB", /* Loudness */
"%", /* Bass boost */
"", /* AVC */
"", /* Channels */
"dB", /* Left gain */
"dB", /* Right gain */
"dB", /* Mic gain */
"dB", /* MDB Strength */
"%", /* MDB Harmonics */
"Hz", /* MDB Center */
"Hz", /* MDB Shape */
"", /* MDB Enable */
"", /* Super bass */
};
static int numdecimals[] =
@ -83,12 +88,37 @@ static int numdecimals[] =
0, /* Treble */
0, /* Balance */
0, /* Loudness */
0, /* Bass boost */
0, /* AVC */
0, /* Channels */
1, /* Left gain */
1, /* Right gain */
1, /* Mic gain */
0, /* MDB Strength */
0, /* MDB Harmonics */
0, /* MDB Center */
0, /* MDB Shape */
0, /* MDB Enable */
0, /* Super bass */
};
static int steps[] =
{
1, /* Volume */
1, /* Bass */
1, /* Treble */
2, /* Balance */
1, /* Loudness */
1, /* AVC */
1, /* Channels */
1, /* Left gain */
1, /* Right gain */
1, /* Mic gain */
1, /* MDB Strength */
1, /* MDB Harmonics */
10, /* MDB Center */
10, /* MDB Shape */
1, /* MDB Enable */
1, /* Super bass */
};
static int minval[] =
@ -103,12 +133,17 @@ static int minval[] =
#endif
-100, /* Balance */
0, /* Loudness */
0, /* Bass boost */
-1, /* AVC */
0, /* Channels */
0, /* Left gain */
0, /* Right gain */
0, /* Mic gain */
0, /* MDB Strength */
0, /* MDB Harmonics */
20, /* MDB Center */
50, /* MDB Shape */
0, /* MDB Enable */
0, /* Super bass */
};
static int maxval[] =
@ -123,12 +158,17 @@ static int maxval[] =
#endif
100, /* Balance */
17, /* Loudness */
100, /* Bass boost */
4, /* AVC */
6, /* Channels */
15, /* Left gain */
15, /* Right gain */
15, /* Mic gain */
127, /* MDB Strength */
100, /* MDB Harmonics */
300, /* MDB Center */
300, /* MDB Shape */
1, /* MDB Enable */
1, /* Super bass */
};
static int defaultval[] =
@ -143,12 +183,17 @@ static int defaultval[] =
#endif
0, /* Balance */
0, /* Loudness */
0, /* Bass boost */
0, /* AVC */
0, /* Channels */
8, /* Left gain */
8, /* Right gain */
2, /* Mic gain */
50, /* MDB Strength */
48, /* MDB Harmonics */
60, /* MDB Center */
90, /* MDB Shape */
0, /* MDB Enable */
0, /* Super bass */
};
char *mpeg_sound_unit(int setting)
@ -161,6 +206,11 @@ int mpeg_sound_numdecimals(int setting)
return numdecimals[setting];
}
int mpeg_sound_steps(int setting)
{
return steps[setting];
}
int mpeg_sound_min(int setting)
{
return minval[setting];
@ -566,6 +616,11 @@ void set_prescaled_volume(void)
#endif /* HAVE_MAS3507D */
#endif /* !SIMULATOR */
#ifdef HAVE_MAS3587F
unsigned long mdb_shape_shadow = 0;
unsigned long loudness_shadow = 0;
#endif
void mpeg_sound_set(int setting, int value)
{
#ifdef SIMULATOR
@ -645,30 +700,10 @@ void mpeg_sound_set(int setting, int value)
break;
#ifdef HAVE_MAS3587F
case SOUND_SUPERBASS:
if (value) {
tmp = MAX(MIN(value * 127 / 100, 0x7f), 0);
mas_codec_writereg(MAS_REG_KMDB_STR, (tmp & 0xff) << 8);
tmp = 0x30; /* MDB_HAR: Space for experiment here */
mas_codec_writereg(MAS_REG_KMDB_HAR, (tmp & 0xff) << 8);
tmp = 60 / 10; /* calculate MDB_FC, 60hz - experiment here,
this would depend on the earphones...
perhaps make it tunable? */
mas_codec_writereg(MAS_REG_KMDB_FC, (tmp & 0xff) << 8);
tmp = (3 * tmp) / 2; /* calculate MDB_SHAPE */
mas_codec_writereg(MAS_REG_KMDB_SWITCH,
((tmp & 0xff) << 8) /* MDB_SHAPE */
| 2); /* MDB_SWITCH enable */
} else {
mas_codec_writereg(MAS_REG_KMDB_STR, 0);
mas_codec_writereg(MAS_REG_KMDB_HAR, 0);
mas_codec_writereg(MAS_REG_KMDB_SWITCH, 0); /* MDB_SWITCH disable */
}
break;
case SOUND_LOUDNESS:
tmp = MAX(MIN(value * 4, 0x44), 0);
mas_codec_writereg(MAS_REG_KLOUDNESS, (tmp & 0xff) << 8);
loudness_shadow = (loudness_shadow & 0x04) |
(MAX(MIN(value * 4, 0x44), 0) << 8);
mas_codec_writereg(MAS_REG_KLOUDNESS, loudness_shadow);
break;
case SOUND_AVC:
@ -695,6 +730,35 @@ void mpeg_sound_set(int setting, int value)
}
mas_codec_writereg(MAS_REG_KAVC, tmp);
break;
case SOUND_MDB_STRENGTH:
mas_codec_writereg(MAS_REG_KMDB_STR, (value & 0x7f) << 8);
break;
case SOUND_MDB_HARMONICS:
tmp = value * 127 / 100;
mas_codec_writereg(MAS_REG_KMDB_HAR, (tmp & 0x7f) << 8);
break;
case SOUND_MDB_CENTER:
mas_codec_writereg(MAS_REG_KMDB_FC, (value/10) << 8);
break;
case SOUND_MDB_SHAPE:
mdb_shape_shadow = (mdb_shape_shadow & 0x02) | ((value/10) << 8);
mas_codec_writereg(MAS_REG_KMDB_SWITCH, mdb_shape_shadow);
break;
case SOUND_MDB_ENABLE:
mdb_shape_shadow = (mdb_shape_shadow & ~0x02) | (value?2:0);
mas_codec_writereg(MAS_REG_KMDB_SWITCH, mdb_shape_shadow);
break;
case SOUND_SUPERBASS:
loudness_shadow = (loudness_shadow & ~0x04) |
(value?4:0);
mas_codec_writereg(MAS_REG_KLOUDNESS, loudness_shadow);
break;
#endif
case SOUND_CHANNELS:
mpeg_sound_channel_config(value);
@ -832,15 +896,36 @@ void mpeg_set_pitch(int pitch)
#endif
void mp3_init(int volume, int bass, int treble, int balance, int loudness,
int bass_boost, int avc, int channel_config)
int avc, int channel_config,
int mdb_strength, int mdb_harmonics,
int mdb_center, int mdb_shape, bool mdb_enable,
bool superbass)
{
#ifdef SIMULATOR
volume = bass = treble = balance = loudness
= bass_boost = avc = channel_config;
(void)volume;
(void)bass;
(void)treble;
(void)balance;
(void)loudness;
(void)avc;
(void)channel_config;
(void)mdb_strength;
(void)mdb_harmonics;
(void)mdb_center;
(void)mdb_shape;
(void)mdb_enable;
(void)superbass;
#else
#ifdef HAVE_MAS3507D
unsigned long val;
loudness = bass_boost = avc;
(void)loudness;
(void)avc;
(void)mdb_strength;
(void)mdb_harmonics;
(void)mdb_center;
(void)mdb_shape;
(void)mdb_enable;
(void)superbass;
#endif
setup_sci0();
@ -929,8 +1014,13 @@ void mp3_init(int volume, int bass, int treble, int balance, int loudness,
#ifdef HAVE_MAS3587F
mpeg_sound_channel_config(channel_config);
mpeg_sound_set(SOUND_LOUDNESS, loudness);
mpeg_sound_set(SOUND_SUPERBASS, bass_boost);
mpeg_sound_set(SOUND_AVC, avc);
mpeg_sound_set(SOUND_MDB_STRENGTH, mdb_strength);
mpeg_sound_set(SOUND_MDB_HARMONICS, mdb_harmonics);
mpeg_sound_set(SOUND_MDB_CENTER, mdb_center);
mpeg_sound_set(SOUND_MDB_SHAPE, mdb_shape);
mpeg_sound_set(SOUND_MDB_ENABLE, mdb_enable);
mpeg_sound_set(SOUND_SUPERBASS, superbass);
#endif
#endif /* !SIMULATOR */