From 7b1dd6b60a1b39468be02bb7a1e71f4be354ce0f Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Fri, 8 Dec 2023 20:30:59 -0500 Subject: RFC: Extend skin engine to handle EQ settings EQ settings are actually an array of 3 ints. I added a skin parameter token that allows specifying which array element to use. So instead of this now-incorrect syntax: %St(0,0,-,-,image,eqbar.bmp,vertical,setting,eq band 1 gain) You would use: %St(0,0,-,-,image,eqbar.bmp,vertical,soffset,2,setting,eq peak filter 1) (the 'gain' is the third element in the eq setting array, thus soffset 2) Change-Id: Ibda712ab87759efb45420566c967742bcefb513b --- apps/gui/option_select.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'apps/gui/option_select.c') diff --git a/apps/gui/option_select.c b/apps/gui/option_select.c index afc11fc4ee..1ce7fd5026 100644 --- a/apps/gui/option_select.c +++ b/apps/gui/option_select.c @@ -594,7 +594,7 @@ bool option_screen(const struct settings_list *setting, return false; } -int get_setting_info_for_bar(const struct settings_list *setting, int *count, int *val) +int get_setting_info_for_bar(const struct settings_list *setting, int offset, int *count, int *val) { int var_type = setting->flags&F_T_MASK; void (*function)(int) = NULL; @@ -602,7 +602,9 @@ int get_setting_info_for_bar(const struct settings_list *setting, int *count, in if (var_type == F_T_INT || var_type == F_T_UINT) { - oldvalue = *(int*)setting->setting; + if (!(setting->flags&F_EQSETTING) || offset > 2) + offset = 0; + oldvalue = ((int*)setting->setting)[offset]; } else if (var_type == F_T_BOOL) { @@ -620,14 +622,16 @@ int get_setting_info_for_bar(const struct settings_list *setting, int *count, in } #ifdef HAVE_TOUCHSCREEN -void update_setting_value_from_touch(const struct settings_list *setting, int selection) +void update_setting_value_from_touch(const struct settings_list *setting, int offset, int selection) { int new_val = selection_to_val(setting, selection); int var_type = setting->flags&F_T_MASK; if (var_type == F_T_INT || var_type == F_T_UINT) { - *(int*)setting->setting = new_val; + if (!(setting->flags&F_EQSETTING) || offset > 2) + offset = 0; + ((int*)setting->setting)[offset] = new_val; } else if (var_type == F_T_BOOL) { -- cgit v1.2.3