FS#13220: Allow sound settings to be saved again

(Basically this reverts bf546fbfcb and its successors)

Change-Id: I044cfb797d306412837e7509cb85b65bc6ffacca
This commit is contained in:
Solomon Peachy 2020-07-27 18:41:02 -04:00
parent b9d13b898d
commit 3f828e9244
2 changed files with 4 additions and 11 deletions

View file

@ -300,14 +300,7 @@ bool settings_load_config(const char* file, bool apply)
#endif #endif
if (settings[i].cfg_vals == NULL) if (settings[i].cfg_vals == NULL)
{ {
int temp = atoi(value); *(int*)settings[i].setting = atoi(value);
if (settings[i].flags&F_ALLOW_ARBITRARY_VALS ||
(temp >= settings[i].int_setting->min &&
temp <= settings[i].int_setting->max &&
temp % settings[i].int_setting->step == 0))
{
*(int*)settings[i].setting = temp;
}
} }
else else
{ {

View file

@ -93,7 +93,7 @@
/* Use for int settings which use the set_sound() function to set them */ /* Use for int settings which use the set_sound() function to set them */
#define SOUND_SETTING(flags,var,lang_id,name,setting) \ #define SOUND_SETTING(flags,var,lang_id,name,setting) \
{flags|F_T_INT|F_T_SOUND|F_SOUNDSETTING, &global_settings.var, \ {flags|F_T_INT|F_T_SOUND|F_SOUNDSETTING|F_ALLOW_ARBITRARY_VALS, &global_settings.var, \
lang_id, NODEFAULT,name,NULL, \ lang_id, NODEFAULT,name,NULL, \
{.sound_setting=(struct sound_setting[]){{setting}}} } {.sound_setting=(struct sound_setting[]){{setting}}} }
@ -817,14 +817,14 @@ const struct settings_list settings[] = {
#endif /* HAVE_WM8978 */ #endif /* HAVE_WM8978 */
#endif /* AUDIOHW_HAVE_EQ */ #endif /* AUDIOHW_HAVE_EQ */
/* 3-d enhancement effect */ /* 3-d enhancement effect */
CHOICE_SETTING(F_SOUNDSETTING, channel_config, LANG_CHANNEL_CONFIGURATION, CHOICE_SETTING(0, channel_config, LANG_CHANNEL_CONFIGURATION,
0,"channels", 0,"channels",
"stereo,mono,custom,mono left,mono right,karaoke", "stereo,mono,custom,mono left,mono right,karaoke",
sound_set_channels, 6, sound_set_channels, 6,
ID2P(LANG_CHANNEL_STEREO), ID2P(LANG_CHANNEL_MONO), ID2P(LANG_CHANNEL_STEREO), ID2P(LANG_CHANNEL_MONO),
ID2P(LANG_CHANNEL_CUSTOM), ID2P(LANG_CHANNEL_LEFT), ID2P(LANG_CHANNEL_CUSTOM), ID2P(LANG_CHANNEL_LEFT),
ID2P(LANG_CHANNEL_RIGHT), ID2P(LANG_CHANNEL_KARAOKE)), ID2P(LANG_CHANNEL_RIGHT), ID2P(LANG_CHANNEL_KARAOKE)),
SOUND_SETTING(F_SOUNDSETTING, stereo_width, LANG_STEREO_WIDTH, SOUND_SETTING(0, stereo_width, LANG_STEREO_WIDTH,
"stereo_width", SOUND_STEREO_WIDTH), "stereo_width", SOUND_STEREO_WIDTH),
#ifdef AUDIOHW_HAVE_DEPTH_3D #ifdef AUDIOHW_HAVE_DEPTH_3D
SOUND_SETTING(0,depth_3d, LANG_DEPTH_3D, "3-d enhancement", SOUND_SETTING(0,depth_3d, LANG_DEPTH_3D, "3-d enhancement",