diff options
| author | Michael Sevakis <jethead71@rockbox.org> | 2012-04-26 17:19:16 -0400 |
|---|---|---|
| committer | Michael Sevakis <jethead71@rockbox.org> | 2012-04-26 17:19:16 -0400 |
| commit | 0842d7f7e1f123926bc7741c6ecfbcd631a65bea (patch) | |
| tree | 3030e3bd5e1a322a8601379f2bd61aa71a50fc99 /apps | |
| parent | 97a535d83c0f057b190c7a82f95297696b25a0df (diff) | |
| download | rockbox-0842d7f7e1f123926bc7741c6ecfbcd631a65bea.zip rockbox-0842d7f7e1f123926bc7741c6ecfbcd631a65bea.tar.gz rockbox-0842d7f7e1f123926bc7741c6ecfbcd631a65bea.tar.bz2 rockbox-0842d7f7e1f123926bc7741c6ecfbcd631a65bea.tar.xz | |
Consolidate compressor settings into a struct.
Doing that makes things cleaner for later on.
Change-Id: I4e279aa57ace16a348acc0fc09059592325ec95f
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/menus/sound_menu.c | 15 | ||||
| -rw-r--r-- | apps/settings.c | 7 | ||||
| -rw-r--r-- | apps/settings.h | 13 | ||||
| -rw-r--r-- | apps/settings_list.c | 15 |
4 files changed, 28 insertions, 22 deletions
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index e93d73b..0817304 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c @@ -126,15 +126,20 @@ static int timestretch_callback(int action,const struct menu_item_ex *this_item) /* compressor submenu */ MENUITEM_SETTING(compressor_threshold, - &global_settings.compressor_threshold, lowlatency_callback); + &global_settings.compressor_settings.threshold, + lowlatency_callback); MENUITEM_SETTING(compressor_gain, - &global_settings.compressor_makeup_gain, lowlatency_callback); + &global_settings.compressor_settings.makeup_gain, + lowlatency_callback); MENUITEM_SETTING(compressor_ratio, - &global_settings.compressor_ratio, lowlatency_callback); + &global_settings.compressor_settings.ratio, + lowlatency_callback); MENUITEM_SETTING(compressor_knee, - &global_settings.compressor_knee, lowlatency_callback); + &global_settings.compressor_settings.knee, + lowlatency_callback); MENUITEM_SETTING(compressor_release, - &global_settings.compressor_release_time, lowlatency_callback); + &global_settings.compressor_settings.release_time, + lowlatency_callback); MAKE_MENU(compressor_menu,ID2P(LANG_COMPRESSOR), NULL, Icon_NOICON, &compressor_threshold, &compressor_gain, &compressor_ratio, &compressor_knee, &compressor_release); diff --git a/apps/settings.c b/apps/settings.c index 13913f2..a267f51 100644 --- a/apps/settings.c +++ b/apps/settings.c @@ -781,9 +781,6 @@ void settings_apply(bool read_disk) #ifdef HAVE_LCD_BITMAP int rc; #endif -#if CONFIG_CODEC == SWCODEC - int i; -#endif sound_settings_apply(); #ifdef HAVE_DISK_STORAGE @@ -991,7 +988,7 @@ void settings_apply(bool read_disk) /* Configure software equalizer, hardware eq is handled in audio_init() */ dsp_set_eq(global_settings.eq_enabled); dsp_set_eq_precut(global_settings.eq_precut); - for(i = 0; i < 5; i++) { + for(int i = 0; i < 5; i++) { dsp_set_eq_coefs(i); } @@ -999,7 +996,7 @@ void settings_apply(bool read_disk) #ifdef HAVE_PITCHSCREEN dsp_timestretch_enable(global_settings.timestretch_enabled); #endif - dsp_set_compressor(); + dsp_set_compressor(&global_settings.compressor_settings); #endif #ifdef HAVE_SPDIF_POWER diff --git a/apps/settings.h b/apps/settings.h index fb562c9..b312c1e 100644 --- a/apps/settings.h +++ b/apps/settings.h @@ -772,11 +772,14 @@ struct user_settings #endif #if CONFIG_CODEC == SWCODEC - int compressor_threshold; - int compressor_makeup_gain; - int compressor_ratio; - int compressor_knee; - int compressor_release_time; + struct compressor_settings + { + int threshold; + int makeup_gain; + int ratio; + int knee; + int release_time; + } compressor_settings; #endif int sleeptimer_duration; /* In minutes; 0=off */ diff --git a/apps/settings_list.c b/apps/settings_list.c index 6780c78..af48d11 100644 --- a/apps/settings_list.c +++ b/apps/settings_list.c @@ -436,7 +436,7 @@ static void crossfeed_cross_set(int val) static void compressor_set(int val) { (void)val; - dsp_set_compressor(); + dsp_set_compressor(&global_settings.compressor_settings); } static const char* db_format(char* buffer, size_t buffer_size, int value, @@ -1482,25 +1482,26 @@ const struct settings_list settings[] = { #endif /* compressor */ - INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_threshold, + INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.threshold, LANG_COMPRESSOR_THRESHOLD, 0, "compressor threshold", UNIT_DB, 0, -24, - -3, formatter_unit_0_is_off, getlang_unit_0_is_off, compressor_set), - CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_makeup_gain, + -3, formatter_unit_0_is_off, getlang_unit_0_is_off, + compressor_set), + CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_settings.makeup_gain, LANG_COMPRESSOR_GAIN, 1, "compressor makeup gain", "off,auto", compressor_set, 2, ID2P(LANG_OFF), ID2P(LANG_AUTO)), - CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_ratio, + CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_settings.ratio, LANG_COMPRESSOR_RATIO, 1, "compressor ratio", "2:1,4:1,6:1,10:1,limit", compressor_set, 5, ID2P(LANG_COMPRESSOR_RATIO_2), ID2P(LANG_COMPRESSOR_RATIO_4), ID2P(LANG_COMPRESSOR_RATIO_6), ID2P(LANG_COMPRESSOR_RATIO_10), ID2P(LANG_COMPRESSOR_RATIO_LIMIT)), - CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_knee, + CHOICE_SETTING(F_SOUNDSETTING|F_NO_WRAP, compressor_settings.knee, LANG_COMPRESSOR_KNEE, 1, "compressor knee", "hard knee,soft knee", compressor_set, 2, ID2P(LANG_COMPRESSOR_HARD_KNEE), ID2P(LANG_COMPRESSOR_SOFT_KNEE)), - INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_release_time, + INT_SETTING_NOWRAP(F_SOUNDSETTING, compressor_settings.release_time, LANG_COMPRESSOR_RELEASE, 500, "compressor release time", UNIT_MS, 100, 1000, 100, NULL, NULL, compressor_set), |