forked from len0rd/rockbox
Sound settings rework: * Put all fixed parameters (unit, decimals, step, min, max, default, set function) for the individual settings into one structure array. * Use the new individual sound setting functions where appropriate. * Added dummy sound setting functions and defined the codec type for the sims. Fixes wrong sound settings ranges in the simulators. * Code cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7770 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4d9be96a81
commit
8051a0b724
21 changed files with 250 additions and 333 deletions
|
@ -1228,7 +1228,7 @@ void audio_play_start(int offset)
|
|||
}
|
||||
|
||||
memset(&tracks, 0, sizeof(struct track_info) * MAX_TRACK);
|
||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
sound_set_volume(global_settings.volume);
|
||||
track_count = 0;
|
||||
track_widx = 0;
|
||||
track_ridx = 0;
|
||||
|
|
|
@ -1045,9 +1045,11 @@ void sound_neutral(void)
|
|||
rb->sound_set(SOUND_TREBLE, 0);
|
||||
rb->sound_set(SOUND_BALANCE, 0);
|
||||
rb->sound_set(SOUND_VOLUME, 92); /* 0 dB */
|
||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||
rb->sound_set(SOUND_LOUDNESS, 0);
|
||||
rb->sound_set(SOUND_SUPERBASS, 0);
|
||||
rb->sound_set(SOUND_AVC, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* return to user settings */
|
||||
|
@ -1057,9 +1059,11 @@ void sound_normal(void)
|
|||
rb->sound_set(SOUND_TREBLE, rb->global_settings->treble);
|
||||
rb->sound_set(SOUND_BALANCE, rb->global_settings->balance);
|
||||
rb->sound_set(SOUND_VOLUME, rb->global_settings->volume);
|
||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||
rb->sound_set(SOUND_LOUDNESS, rb->global_settings->loudness);
|
||||
rb->sound_set(SOUND_SUPERBASS, rb->global_settings->superbass);
|
||||
rb->sound_set(SOUND_AVC, rb->global_settings->avc);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* the thread running it all */
|
||||
|
|
|
@ -410,7 +410,7 @@ bool radio_screen(void)
|
|||
global_settings.volume++;
|
||||
if(global_settings.volume > sound_max(SOUND_VOLUME))
|
||||
global_settings.volume = sound_max(SOUND_VOLUME);
|
||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
sound_set_volume(global_settings.volume);
|
||||
update_screen = true;
|
||||
settings_save();
|
||||
break;
|
||||
|
@ -420,7 +420,7 @@ bool radio_screen(void)
|
|||
global_settings.volume--;
|
||||
if(global_settings.volume < sound_min(SOUND_VOLUME))
|
||||
global_settings.volume = sound_min(SOUND_VOLUME);
|
||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
sound_set_volume(global_settings.volume);
|
||||
update_screen = true;
|
||||
settings_save();
|
||||
break;
|
||||
|
|
|
@ -291,7 +291,7 @@ bool recording_screen(void)
|
|||
#endif
|
||||
mpeg_init_recording();
|
||||
|
||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
sound_set_volume(global_settings.volume);
|
||||
|
||||
/* Yes, we use the D/A for monitoring */
|
||||
peak_meter_playback(true);
|
||||
|
|
|
@ -827,7 +827,7 @@ void settings_apply(void)
|
|||
backlight_set_fade_out(global_settings.backlight_fade_out);
|
||||
#endif
|
||||
ata_spindown(global_settings.disk_spindown);
|
||||
#if CONFIG_CODEC == MAS3507D
|
||||
#if (CONFIG_CODEC == MAS3507D) && !defined(SIMULATOR)
|
||||
dac_line_in(global_settings.line_in);
|
||||
#endif
|
||||
mpeg_id3_options(global_settings.id3_v1_first);
|
||||
|
@ -1329,16 +1329,18 @@ void settings_reset(void) {
|
|||
global_settings.balance = sound_default(SOUND_BALANCE);
|
||||
global_settings.bass = sound_default(SOUND_BASS);
|
||||
global_settings.treble = sound_default(SOUND_TREBLE);
|
||||
global_settings.loudness = sound_default(SOUND_LOUDNESS);
|
||||
global_settings.avc = sound_default(SOUND_AVC);
|
||||
global_settings.channel_config = sound_default(SOUND_CHANNELS);
|
||||
global_settings.stereo_width = sound_default(SOUND_STEREO_WIDTH);
|
||||
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
||||
global_settings.loudness = sound_default(SOUND_LOUDNESS);
|
||||
global_settings.avc = sound_default(SOUND_AVC);
|
||||
global_settings.mdb_strength = sound_default(SOUND_MDB_STRENGTH);
|
||||
global_settings.mdb_harmonics = sound_default(SOUND_MDB_HARMONICS);
|
||||
global_settings.mdb_center = sound_default(SOUND_MDB_CENTER);
|
||||
global_settings.mdb_shape = sound_default(SOUND_MDB_SHAPE);
|
||||
global_settings.mdb_enable = sound_default(SOUND_MDB_ENABLE);
|
||||
global_settings.superbass = sound_default(SOUND_SUPERBASS);
|
||||
#endif
|
||||
global_settings.contrast = lcd_default_contrast();
|
||||
global_settings.wps_file[0] = '\0';
|
||||
global_settings.font_file[0] = '\0';
|
||||
|
|
|
@ -882,7 +882,9 @@ static bool poweroff(void)
|
|||
static bool line_in(void)
|
||||
{
|
||||
bool rc = set_bool(str(LANG_LINE_IN), &global_settings.line_in);
|
||||
#ifndef SIMULATOR
|
||||
dac_line_in(global_settings.line_in);
|
||||
#endif
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -62,13 +62,13 @@ bool set_sound(const char* string,
|
|||
int steps = sound_steps(setting);
|
||||
int min = sound_min(setting);
|
||||
int max = sound_max(setting);
|
||||
void(*sound_callback)(int)=sound_get_fn(setting);
|
||||
sound_set_type* sound_callback = sound_get_fn(setting);
|
||||
if (*unit == 'd') /* crude reconstruction */
|
||||
talkunit = UNIT_DB;
|
||||
else if (*unit == '%')
|
||||
talkunit = UNIT_PERCENT;
|
||||
else if (*unit == 'H')
|
||||
talkunit = UNIT_HERTZ;
|
||||
talkunit = UNIT_HERTZ;
|
||||
if(!numdec)
|
||||
return set_int(string, unit, talkunit, variable, sound_callback,
|
||||
steps, min, max, NULL );
|
||||
|
@ -134,7 +134,7 @@ static bool mdb_shape(void)
|
|||
|
||||
static void set_mdb_enable(bool value)
|
||||
{
|
||||
sound_set(SOUND_MDB_ENABLE, (int)value);
|
||||
sound_set_mdb_enable((int)value);
|
||||
}
|
||||
|
||||
static bool mdb_enable(void)
|
||||
|
@ -148,7 +148,7 @@ static bool mdb_enable(void)
|
|||
|
||||
static void set_superbass(bool value)
|
||||
{
|
||||
sound_set(SOUND_SUPERBASS, (int)value);
|
||||
sound_set_superbass((int)value);
|
||||
}
|
||||
|
||||
static bool superbass(void)
|
||||
|
@ -160,11 +160,6 @@ static bool superbass(void)
|
|||
set_superbass);
|
||||
}
|
||||
|
||||
static void set_avc(int val)
|
||||
{
|
||||
sound_set(SOUND_AVC, val);
|
||||
}
|
||||
|
||||
static bool avc(void)
|
||||
{
|
||||
static const struct opt_items names[] = {
|
||||
|
@ -175,7 +170,7 @@ static bool avc(void)
|
|||
{ "8s", TALK_ID(8, UNIT_SEC) }
|
||||
};
|
||||
return set_option(str(LANG_DECAY), &global_settings.avc, INT,
|
||||
names, 5, set_avc);
|
||||
names, 5, sound_set_avc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -317,11 +312,6 @@ static bool reconstartup(void)
|
|||
|
||||
#endif /* MAS3587F */
|
||||
|
||||
static void set_chanconf(int val)
|
||||
{
|
||||
sound_set(SOUND_CHANNELS, val);
|
||||
}
|
||||
|
||||
static bool chanconf(void)
|
||||
{
|
||||
static const struct opt_items names[] = {
|
||||
|
@ -333,7 +323,7 @@ static bool chanconf(void)
|
|||
{ STR(LANG_CHANNEL_KARAOKE) }
|
||||
};
|
||||
return set_option(str(LANG_CHANNEL), &global_settings.channel_config, INT,
|
||||
names, 6, set_chanconf );
|
||||
names, 6, sound_set_channels);
|
||||
}
|
||||
|
||||
static bool stereo_width(void)
|
||||
|
|
12
apps/wps.c
12
apps/wps.c
|
@ -77,7 +77,7 @@ static bool setvol(void)
|
|||
global_settings.volume = sound_min(SOUND_VOLUME);
|
||||
if (global_settings.volume > sound_max(SOUND_VOLUME))
|
||||
global_settings.volume = sound_max(SOUND_VOLUME);
|
||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
sound_set_volume(global_settings.volume);
|
||||
status_draw(false);
|
||||
wps_refresh(id3, nid3, 0, WPS_REFRESH_NON_STATIC);
|
||||
settings_save();
|
||||
|
@ -267,7 +267,7 @@ static void fade(bool fade_in)
|
|||
unsigned fp_volume = 0;
|
||||
|
||||
/* zero out the sound */
|
||||
sound_set(SOUND_VOLUME, 0);
|
||||
sound_set_volume(0);
|
||||
|
||||
sleep(HZ/10); /* let audio thread run */
|
||||
audio_resume();
|
||||
|
@ -275,9 +275,9 @@ static void fade(bool fade_in)
|
|||
while (fp_volume < fp_global_vol) {
|
||||
fp_volume += fp_step;
|
||||
sleep(1);
|
||||
sound_set(SOUND_VOLUME, fp_volume >> 8);
|
||||
sound_set_volume(fp_volume >> 8);
|
||||
}
|
||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
sound_set_volume(global_settings.volume);
|
||||
}
|
||||
else {
|
||||
/* fade out */
|
||||
|
@ -286,7 +286,7 @@ static void fade(bool fade_in)
|
|||
while (fp_volume > fp_step) {
|
||||
fp_volume -= fp_step;
|
||||
sleep(1);
|
||||
sound_set(SOUND_VOLUME, fp_volume >> 8);
|
||||
sound_set_volume(fp_volume >> 8);
|
||||
}
|
||||
audio_pause();
|
||||
#ifndef SIMULATOR
|
||||
|
@ -296,7 +296,7 @@ static void fade(bool fade_in)
|
|||
sleep(HZ/10);
|
||||
|
||||
/* reset volume to what it was before the fade */
|
||||
sound_set(SOUND_VOLUME, global_settings.volume);
|
||||
sound_set_volume(global_settings.volume);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue