diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2011-10-10 01:39:56 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2011-10-10 01:39:56 +0000 |
commit | b8f0b09916d94c55fff683aa3d89f076cc2d300f (patch) | |
tree | dee9a746a3be0ed82c301763c8b85c889074b197 | |
parent | 0aa12a9717cbd73b8cbd3048737dc5d81357a50b (diff) | |
download | rockbox-b8f0b09916d94c55fff683aa3d89f076cc2d300f.tar.gz rockbox-b8f0b09916d94c55fff683aa3d89f076cc2d300f.zip |
mpegplayer sync_audio_setting(): simplify / clarify
fix fuze+ yellow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30739 a1c6a512-1295-4272-9138-f99709370657
-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, | |||
397 | /* Sync a particular audio setting to global or mpegplayer forced off */ | 397 | /* Sync a particular audio setting to global or mpegplayer forced off */ |
398 | static void sync_audio_setting(int setting, bool global) | 398 | static void sync_audio_setting(int setting, bool global) |
399 | { | 399 | { |
400 | int val0, val1; | ||
401 | |||
402 | switch (setting) | 400 | switch (setting) |
403 | { | 401 | { |
404 | case MPEG_AUDIO_TONE_CONTROLS: | 402 | case MPEG_AUDIO_TONE_CONTROLS: |
405 | #if defined(AUDIOHW_HAVE_BASS) || defined(AUDIOHW_HAVE_TREBLE) | ||
406 | if (global || settings.tone_controls) | ||
407 | { | ||
408 | #ifdef AUDIOHW_HAVE_BASS | ||
409 | val0 = rb->global_settings->bass; | ||
410 | #endif | ||
411 | #ifdef AUDIOHW_HAVE_TREBLE | ||
412 | val1 = rb->global_settings->treble; | ||
413 | #endif | ||
414 | } | ||
415 | else | ||
416 | { | ||
417 | #ifdef AUDIOHW_HAVE_BASS | ||
418 | val0 = rb->sound_default(SOUND_BASS); | ||
419 | #endif | ||
420 | #ifdef AUDIOHW_HAVE_TREBLE | ||
421 | val1 = rb->sound_default(SOUND_TREBLE); | ||
422 | #endif | ||
423 | } | ||
424 | #ifdef AUDIOHW_HAVE_BASS | 403 | #ifdef AUDIOHW_HAVE_BASS |
425 | rb->sound_set(SOUND_BASS, val0); | 404 | rb->sound_set(SOUND_BASS, (global || settings.tone_controls) |
405 | ? rb->global_settings->bass | ||
406 | : rb->sound_default(SOUND_BASS)); | ||
426 | #endif | 407 | #endif |
427 | #ifdef AUDIOHW_HAVE_TREBLE | 408 | #ifdef AUDIOHW_HAVE_TREBLE |
428 | rb->sound_set(SOUND_TREBLE, val1); | 409 | rb->sound_set(SOUND_TREBLE, (global || settings.tone_controls) |
410 | ? rb->global_settings->treble | ||
411 | : rb->sound_default(SOUND_TREBLE); | ||
429 | #endif | 412 | #endif |
430 | #endif /* AUDIOHW_HAVE_BASS || AUDIOHW_HAVE_TREBLE */ | ||
431 | 413 | ||
432 | #ifdef AUDIOHW_HAVE_EQ | 414 | #ifdef AUDIOHW_HAVE_EQ |
433 | for (val1 = 0;; val1++) | 415 | for (int band = 0;; band++) |
434 | { | 416 | { |
435 | int setting = rb->sound_enum_hw_eq_band_setting(val1, AUDIOHW_EQ_GAIN); | 417 | int setting = rb->sound_enum_hw_eq_band_setting(band, AUDIOHW_EQ_GAIN); |
436 | 418 | ||
437 | if (setting == -1) | 419 | if (setting == -1) |
438 | break; | 420 | break; |
439 | 421 | ||
440 | if (global || settings.tone_controls) | 422 | rb->sound_set(setting, (global || settings.tone_controls) |
441 | { | 423 | ? rb->global_settings->hw_eq_bands[band].gain |
442 | val0 = rb->global_settings->hw_eq_bands[val1].gain; | 424 | : rb->sound_default(setting)); |
443 | } | ||
444 | else | ||
445 | { | ||
446 | val0 = rb->sound_default(setting); | ||
447 | } | ||
448 | |||
449 | rb->sound_set(setting, val0); | ||
450 | } | 425 | } |
451 | #endif /* AUDIOHW_HAVE_EQ */ | 426 | #endif /* AUDIOHW_HAVE_EQ */ |
452 | break; | 427 | break; |
453 | 428 | ||
454 | case MPEG_AUDIO_CHANNEL_MODES: | 429 | case MPEG_AUDIO_CHANNEL_MODES: |
455 | val0 = (global || settings.channel_modes) ? | 430 | rb->sound_set(SOUND_CHANNELS, (global || settings.channel_modes) |
456 | rb->global_settings->channel_config : | 431 | ? rb->global_settings->channel_config |
457 | SOUND_CHAN_STEREO; | 432 | : SOUND_CHAN_STEREO); |
458 | rb->sound_set(SOUND_CHANNELS, val0); | ||
459 | break; | 433 | break; |
460 | 434 | ||
461 | case MPEG_AUDIO_CROSSFEED: | 435 | case MPEG_AUDIO_CROSSFEED: |