diff --git a/apps/settings.c b/apps/settings.c index e93411a8a2..2667df743b 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -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) diff --git a/apps/settings.h b/apps/settings.h index 437f0937dd..35c345aaad 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -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); diff --git a/apps/settings_menu.c b/apps/settings_menu.c index 3b83e18fe4..9b18a11493 100644 --- a/apps/settings_menu.c +++ b/apps/settings_menu.c @@ -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)); diff --git a/firmware/mpeg.c b/firmware/mpeg.c index 61a8fc8208..d7c360550a 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -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);