Resetting settings in the menu now applies the settings as well

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2486 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Linus Nielsen Feltzing 2002-10-03 09:31:01 +00:00
parent 2eda5385d3
commit 40ffbb1a89
4 changed files with 37 additions and 11 deletions

View File

@ -344,6 +344,32 @@ int settings_save( void )
return 0;
}
void settings_apply(void)
{
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);
#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);
#endif
lcd_set_contrast(global_settings.contrast);
lcd_scroll_speed(global_settings.scroll_speed);
backlight_set_timeout(global_settings.backlight_timeout);
#ifdef HAVE_CHARGE_CTRL
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
#endif
ata_spindown(global_settings.disk_spindown);
set_poweroff_timeout(global_settings.poweroff);
#ifdef HAVE_CHARGE_CTRL
charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI;
#endif
}
/*
* load settings from disk or RTC RAM
*/
@ -448,17 +474,8 @@ void settings_load(void)
strncpy(global_settings.resume_file, &config_block[0xFC], MAX_PATH);
global_settings.resume_file[MAX_PATH]=0;
}
lcd_set_contrast(global_settings.contrast);
lcd_scroll_speed(global_settings.scroll_speed);
backlight_set_timeout(global_settings.backlight_timeout);
#ifdef HAVE_CHARGE_CTRL
backlight_set_on_when_charging(global_settings.backlight_on_when_charging);
#endif
ata_spindown(global_settings.disk_spindown);
set_poweroff_timeout(global_settings.poweroff);
#ifdef HAVE_CHARGE_CTRL
charge_restart_level = global_settings.discharge ? CHARGE_RESTART_LO : CHARGE_RESTART_HI;
#endif
settings_apply();
}
static int read_line(int fd, char* buffer, int buffer_size)

View File

@ -110,6 +110,7 @@ struct user_settings
int settings_save(void);
void settings_load(void);
void settings_reset(void);
void settings_apply(void);
void settings_display(void);
bool settings_load_eq(char* file);

View File

@ -345,6 +345,7 @@ static bool reset_settings(void)
button = button_get(true);
if (button == BUTTON_PLAY) {
settings_reset();
settings_apply();
lcd_clear_display();
lcd_puts(0,0,str(LANG_RESET_DONE_SETTING));
lcd_puts(0,1,str(LANG_RESET_DONE_CLEAR));

View File

@ -170,6 +170,7 @@ static struct id3tag _id3tags[MAX_ID3_TAGS];
static unsigned int current_track_counter = 0;
static unsigned int last_track_counter = 0;
static bool mpeg_is_initialized = false;
#ifndef SIMULATOR
@ -1601,6 +1602,9 @@ void mpeg_sound_set(int setting, int value)
#else
int tmp;
#endif
if(!mpeg_is_initialized)
return;
switch(setting)
{
@ -2013,6 +2017,9 @@ void mpeg_init(int volume, int bass, int treble, int balance, int loudness, int
mpeg_sound_channel_config(MPEG_SOUND_STEREO);
#endif
/* Must be done before calling mpeg_sound_set() */
mpeg_is_initialized = true;
mpeg_sound_set(SOUND_BASS, bass);
mpeg_sound_set(SOUND_TREBLE, treble);