diff options
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_settings.c | 54 |
1 files changed, 14 insertions, 40 deletions
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index 76eb93d5e6..4f0d9e1c5a 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c @@ -397,65 +397,39 @@ static const char* backlight_brightness_formatter(char *buf, size_t length, /* Sync a particular audio setting to global or mpegplayer forced off */ static void sync_audio_setting(int setting, bool global) { - int val0, val1; - switch (setting) { case MPEG_AUDIO_TONE_CONTROLS: - #if defined(AUDIOHW_HAVE_BASS) || defined(AUDIOHW_HAVE_TREBLE) - if (global || settings.tone_controls) - { - #ifdef AUDIOHW_HAVE_BASS - val0 = rb->global_settings->bass; - #endif - #ifdef AUDIOHW_HAVE_TREBLE - val1 = rb->global_settings->treble; - #endif - } - else - { - #ifdef AUDIOHW_HAVE_BASS - val0 = rb->sound_default(SOUND_BASS); - #endif - #ifdef AUDIOHW_HAVE_TREBLE - val1 = rb->sound_default(SOUND_TREBLE); - #endif - } #ifdef AUDIOHW_HAVE_BASS - rb->sound_set(SOUND_BASS, val0); + rb->sound_set(SOUND_BASS, (global || settings.tone_controls) + ? rb->global_settings->bass + : rb->sound_default(SOUND_BASS)); #endif #ifdef AUDIOHW_HAVE_TREBLE - rb->sound_set(SOUND_TREBLE, val1); + rb->sound_set(SOUND_TREBLE, (global || settings.tone_controls) + ? rb->global_settings->treble + : rb->sound_default(SOUND_TREBLE); #endif - #endif /* AUDIOHW_HAVE_BASS || AUDIOHW_HAVE_TREBLE */ #ifdef AUDIOHW_HAVE_EQ - for (val1 = 0;; val1++) + for (int band = 0;; band++) { - int setting = rb->sound_enum_hw_eq_band_setting(val1, AUDIOHW_EQ_GAIN); + int setting = rb->sound_enum_hw_eq_band_setting(band, AUDIOHW_EQ_GAIN); if (setting == -1) break; - if (global || settings.tone_controls) - { - val0 = rb->global_settings->hw_eq_bands[val1].gain; - } - else - { - val0 = rb->sound_default(setting); - } - - rb->sound_set(setting, val0); + rb->sound_set(setting, (global || settings.tone_controls) + ? rb->global_settings->hw_eq_bands[band].gain + : rb->sound_default(setting)); } #endif /* AUDIOHW_HAVE_EQ */ break; case MPEG_AUDIO_CHANNEL_MODES: - val0 = (global || settings.channel_modes) ? - rb->global_settings->channel_config : - SOUND_CHAN_STEREO; - rb->sound_set(SOUND_CHANNELS, val0); + rb->sound_set(SOUND_CHANNELS, (global || settings.channel_modes) + ? rb->global_settings->channel_config + : SOUND_CHAN_STEREO); break; case MPEG_AUDIO_CROSSFEED: |