summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2013-02-05 23:20:17 +1100
committerJonathan Gordon <rockbox@jdgordon.info>2013-02-09 13:05:32 +0100
commit1eb17dc9f4bf280d2e9503f3d0c8b8730146412d (patch)
treed166a646c42a484edd2ad66e021c4473c4001a91 /apps
parentcb3e40be0a09de1b927fcaab75118dad54c9e563 (diff)
downloadrockbox-1eb17dc9f4bf280d2e9503f3d0c8b8730146412d.tar.gz
rockbox-1eb17dc9f4bf280d2e9503f3d0c8b8730146412d.tar.bz2
rockbox-1eb17dc9f4bf280d2e9503f3d0c8b8730146412d.zip
EQ settings: Rework the settings to clean up the config file.
Instead of 3 cfg lines per eq band there is now a single line for each: <config name>: <cutoff/center freq>, <q>, <gain> In addition, the config value names make a bit more sense. The old settings are still readable but config.cfg and any new settings files will be written with the new config values. (The old settings will be removed completly sometime after the next stable release). Also a slight rework of the advanced EQ menu UI Change-Id: I9008658d36ded442a5f2f825916df42a3934cbef Reviewed-on: http://gerrit.rockbox.org/394 Reviewed-by: Jonathan Gordon <rockbox@jdgordon.info>
Diffstat (limited to 'apps')
-rw-r--r--apps/menus/eq_menu.c552
-rw-r--r--apps/plugins/settings_dumper.c2
-rw-r--r--apps/settings.c2
-rw-r--r--apps/settings_list.c139
-rw-r--r--apps/settings_list.h6
5 files changed, 430 insertions, 271 deletions
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 2f3d6b62c7..8285850155 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -27,6 +27,7 @@
#include "system.h"
#include "kernel.h"
#include "lcd.h"
+#include "list.h"
#include "menu.h"
#include "action.h"
#include "mp3_playback.h"
@@ -46,6 +47,8 @@
#include "menu_common.h"
#include "viewport.h"
#include "exported_menus.h"
+#include "pcmbuf.h"
+#include "option_select.h"
/*
* Utility functions
@@ -70,8 +73,8 @@ const char* eq_precut_format(char* buffer, size_t buffer_size, int value, const
*/
static void eq_apply(void)
{
- dsp_eq_enable(global_settings.eq_enabled);
- dsp_set_eq_precut(global_settings.eq_precut);
+ dsp_eq_enable(global_settings.eq_enabled);
+ dsp_set_eq_precut(global_settings.eq_precut);
/* Update all bands */
for(int i = 0; i < EQ_NUM_BANDS; i++) {
dsp_set_eq_coefs(i, &global_settings.eq_band_settings[i]);
@@ -96,239 +99,315 @@ static int eq_setting_callback(int action, const struct menu_item_ex *this_item)
MENUITEM_SETTING(eq_enable, &global_settings.eq_enabled, eq_setting_callback);
MENUITEM_SETTING(eq_precut, &global_settings.eq_precut, eq_setting_callback);
-MENUITEM_SETTING(cutoff_0, &global_settings.eq_band_settings[0].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_1, &global_settings.eq_band_settings[1].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_2, &global_settings.eq_band_settings[2].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_3, &global_settings.eq_band_settings[3].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_4, &global_settings.eq_band_settings[4].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_5, &global_settings.eq_band_settings[5].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_6, &global_settings.eq_band_settings[6].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_7, &global_settings.eq_band_settings[7].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_8, &global_settings.eq_band_settings[8].cutoff,
- eq_setting_callback);
-MENUITEM_SETTING(cutoff_9, &global_settings.eq_band_settings[9].cutoff,
- eq_setting_callback);
-
-MENUITEM_SETTING(q_0, &global_settings.eq_band_settings[0].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_1, &global_settings.eq_band_settings[1].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_2, &global_settings.eq_band_settings[2].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_3, &global_settings.eq_band_settings[3].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_4, &global_settings.eq_band_settings[4].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_5, &global_settings.eq_band_settings[5].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_6, &global_settings.eq_band_settings[6].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_7, &global_settings.eq_band_settings[7].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_8, &global_settings.eq_band_settings[8].q,
- eq_setting_callback);
-MENUITEM_SETTING(q_9, &global_settings.eq_band_settings[9].q,
- eq_setting_callback);
-
-MENUITEM_SETTING(gain_0, &global_settings.eq_band_settings[0].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_1, &global_settings.eq_band_settings[1].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_2, &global_settings.eq_band_settings[2].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_3, &global_settings.eq_band_settings[3].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_4, &global_settings.eq_band_settings[4].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_5, &global_settings.eq_band_settings[5].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_6, &global_settings.eq_band_settings[6].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_7, &global_settings.eq_band_settings[7].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_8, &global_settings.eq_band_settings[8].gain,
- eq_setting_callback);
-MENUITEM_SETTING(gain_9, &global_settings.eq_band_settings[9].gain,
- eq_setting_callback);
-
-static char* gainitem_get_name(int selected_item, void * data, char *buffer)
+static char* gainitem_get_name(int selected_item, void *data, char *buffer, size_t len)
{
- (void)selected_item;
- int *setting = (int*)data;
- snprintf(buffer, MAX_PATH, str(LANG_EQUALIZER_GAIN_ITEM), *setting);
+ (void)data;
+ snprintf(buffer, len, str(LANG_EQUALIZER_GAIN_ITEM),
+ global_settings.eq_band_settings[selected_item].cutoff);
+
return buffer;
}
-static int gainitem_speak_item(int selected_item, void * data)
+static int gainitem_speak_item(int selected_item, void *data)
{
- (void)selected_item;
- int *setting = (int*)data;
- talk_number(*setting, false);
+ (void)data;
+ talk_number(global_settings.eq_band_settings[selected_item].cutoff, false);
talk_id(LANG_EQUALIZER_GAIN_ITEM, true);
return 0;
}
-static int do_option(void * param)
+static enum themable_icons gainitem_get_icon(int selected_item, void * data)
{
- const struct menu_item_ex *setting = (const struct menu_item_ex*)param;
- lowlatency_callback(ACTION_ENTER_MENUITEM, setting);
- do_setting_from_menu(setting, NULL);
- eq_apply();
- lowlatency_callback(ACTION_EXIT_MENUITEM, setting);
- return 0;
+ (void)selected_item;
+ (void)data;
+
+ return Icon_Menu_functioncall;
}
-MENUITEM_FUNCTION_DYNTEXT(gain_item_0, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_0,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[0].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_1, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_1,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[1].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_2, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_2,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[2].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_3, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_3,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[3].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_4, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_4,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[4].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_5, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_5,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[5].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_6, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_6,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[6].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_7, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_7,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[7].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_8, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_8,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[8].cutoff,
- NULL, Icon_NOICON);
-MENUITEM_FUNCTION_DYNTEXT(gain_item_9, MENU_FUNC_USEPARAM,
- do_option, (void*)&gain_9,
- gainitem_get_name, gainitem_speak_item,
- &global_settings.eq_band_settings[9].cutoff,
- NULL, Icon_NOICON);
-
-MAKE_MENU(gain_menu, ID2P(LANG_EQUALIZER_GAIN), NULL, Icon_NOICON, &gain_item_0,
- &gain_item_1, &gain_item_2, &gain_item_3, &gain_item_4,
- &gain_item_5, &gain_item_6, &gain_item_7, &gain_item_8,
- &gain_item_9);
-
-static const struct menu_item_ex *band_items[8][3] = {
- { &cutoff_1, &q_1, &gain_1 },
- { &cutoff_2, &q_2, &gain_2 },
- { &cutoff_3, &q_3, &gain_3 },
- { &cutoff_4, &q_4, &gain_4 },
- { &cutoff_5, &q_5, &gain_5 },
- { &cutoff_6, &q_6, &gain_6 },
- { &cutoff_7, &q_7, &gain_7 },
- { &cutoff_8, &q_8, &gain_8 }
+static const char* db_format(char* buffer, size_t buffer_size, int value,
+ const char* unit)
+{
+ int v = abs(value);
+
+ snprintf(buffer, buffer_size, "%s%d.%d %s", value < 0 ? "-" : "",
+ v / 10, v % 10, unit);
+ return buffer;
+}
+
+static int32_t get_dec_talkid(int value, int unit)
+{
+ return TALK_ID_DECIMAL(value, 1, unit);
+}
+
+static const struct int_setting gain_int_setting = {
+ .option_callback = NULL,
+ .unit = UNIT_DB,
+ .min = EQ_GAIN_MIN,
+ .max = EQ_GAIN_MAX,
+ .step = EQ_GAIN_STEP,
+ .formatter = db_format,
+ .get_talk_id = get_dec_talkid,
+};
+
+static const struct int_setting q_int_setting = {
+ .option_callback = NULL,
+ .unit = UNIT_INT,
+ .min = EQ_Q_MIN,
+ .max = EQ_Q_MAX,
+ .step = EQ_Q_STEP,
+ .formatter = eq_q_format,
+ .get_talk_id = get_dec_talkid,
+};
+
+static const struct int_setting cutoff_int_setting = {
+ .option_callback = NULL,
+ .unit = UNIT_HERTZ,
+ .min = EQ_CUTOFF_MIN,
+ .max = EQ_CUTOFF_MAX,
+ .step = EQ_CUTOFF_STEP,
+ .formatter = NULL,
+ .get_talk_id = NULL,
};
-static char* centerband_get_name(int selected_item, void * data, char *buffer)
+static int simplelist_action_callback(int action, struct gui_synclist *lists)
{
- (void)selected_item;
- int band = (intptr_t)data;
- snprintf(buffer, MAX_PATH, str(LANG_EQUALIZER_BAND_PEAK), band);
- return buffer;
+ (void)lists;
+ if (action == ACTION_STD_OK)
+ return ACTION_STD_CANCEL;
+ return action;
}
-static int centerband_speak_item(int selected_item, void * data)
+static int eq_do_simple_menu(void * param)
{
- (void)selected_item;
- int band = (intptr_t)data;
- talk_id(LANG_EQUALIZER_BAND_PEAK, false);
- talk_number(band, true);
+ (void)param;
+ struct simplelist_info info;
+ struct settings_list setting;
+ char title[MAX_PATH];
+
+ simplelist_info_init(&info, str(LANG_EQUALIZER_GAIN), EQ_NUM_BANDS, NULL);
+ info.get_name = (list_get_name*)gainitem_get_name;
+ info.get_talk = gainitem_speak_item;
+ info.get_icon = gainitem_get_icon;
+ info.action_callback = simplelist_action_callback;
+ info.selection = -1;
+ info.title_icon = Icon_Submenu;
+ setting.flags = F_BANFROMQS|F_INT_SETTING|F_T_INT|F_NO_WRAP;
+ setting.lang_id = LANG_GAIN;
+ setting.default_val.int_ = 0;
+ setting.int_setting = &gain_int_setting;
+
+ while (true)
+ {
+ simplelist_show_list(&info);
+ if (info.selection < 0)
+ break;
+ pcmbuf_set_low_latency(true);
+ setting.setting = &global_settings.eq_band_settings[info.selection].gain;
+ option_screen(&setting, NULL, false,
+ gainitem_get_name(info.selection, NULL, title, MAX_PATH));
+ eq_apply();
+ pcmbuf_set_low_latency(false);
+ }
return 0;
}
+MENUITEM_FUNCTION(gain_menu, 0, ID2P(LANG_EQUALIZER_GAIN), eq_do_simple_menu,
+ NULL, NULL, Icon_Submenu);
-static int do_center_band_menu(void* param)
+static void selection_to_banditem(int selection, int expanded_band, int *band, int *item)
{
- int band = (intptr_t)param;
- struct menu_item_ex menu;
- struct menu_callback_with_desc cb_and_desc;
- char desc[MAX_PATH];
-
- cb_and_desc.menu_callback = NULL;
- snprintf(desc, MAX_PATH, str(LANG_EQUALIZER_BAND_PEAK), band);
- cb_and_desc.desc = desc;
- cb_and_desc.icon_id = Icon_EQ;
- menu.flags = MT_MENU|(3<<MENU_COUNT_SHIFT)|MENU_HAS_DESC;
- menu.submenus = band_items[band-1];
- menu.callback_and_desc = &cb_and_desc;
- do_menu(&menu, NULL, NULL, false);
- return 0;
+ int diff = selection - expanded_band;
+
+ if (expanded_band < 0 || diff < 0)
+ {
+ *item = 0;
+ *band = selection;
+ }
+ else if (diff < 4)
+ {
+ *item = selection - expanded_band;
+ *band = expanded_band;
+ }
+ else
+ {
+ *item = 0;
+ *band = expanded_band + diff - 3;
+ }
}
-MAKE_MENU(band_0_menu, ID2P(LANG_EQUALIZER_BAND_LOW_SHELF), NULL,
- Icon_EQ, &cutoff_0, &q_0, &gain_0);
-MENUITEM_FUNCTION_DYNTEXT(band_1_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)1,
- centerband_get_name, centerband_speak_item,
- (void*)1, NULL, Icon_EQ);
-MENUITEM_FUNCTION_DYNTEXT(band_2_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)2,
- centerband_get_name, centerband_speak_item,
- (void*)2, NULL, Icon_EQ);
-MENUITEM_FUNCTION_DYNTEXT(band_3_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)3,
- centerband_get_name, centerband_speak_item,
- (void*)3, NULL, Icon_EQ);
-MENUITEM_FUNCTION_DYNTEXT(band_4_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)4,
- centerband_get_name, centerband_speak_item,
- (void*)4, NULL, Icon_EQ);
-MENUITEM_FUNCTION_DYNTEXT(band_5_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)5,
- centerband_get_name, centerband_speak_item,
- (void*)5, NULL, Icon_EQ);
-MENUITEM_FUNCTION_DYNTEXT(band_6_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)6,
- centerband_get_name, centerband_speak_item,
- (void*)6, NULL, Icon_EQ);
-MENUITEM_FUNCTION_DYNTEXT(band_7_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)7,
- centerband_get_name, centerband_speak_item,
- (void*)7, NULL, Icon_EQ);
-MENUITEM_FUNCTION_DYNTEXT(band_8_menu, MENU_FUNC_USEPARAM,
- do_center_band_menu, (void*)8,
- centerband_get_name, centerband_speak_item,
- (void*)8, NULL, Icon_EQ);
-MAKE_MENU(band_9_menu, ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF), NULL,
- Icon_EQ, &cutoff_9, &q_9, &gain_9);
-
-MAKE_MENU(advanced_eq_menu_, ID2P(LANG_EQUALIZER_ADVANCED), NULL, Icon_EQ,
- &band_0_menu, &band_1_menu, &band_2_menu, &band_3_menu, &band_4_menu,
- &band_5_menu, &band_6_menu, &band_7_menu, &band_8_menu, &band_9_menu);
+static char *advancedmenu_item_get_name(int selected_item, void *data, char *buffer, size_t len)
+{
+ (void)len;
+ int band;
+ int item;
+ char *lang = NULL;
+ selection_to_banditem(selected_item, *(intptr_t*)data, &band, &item);
+
+ strcpy(buffer, "\t");
+ switch (item)
+ {
+ case 0: /* Band title */
+ if (band == 0)
+ return str(LANG_EQUALIZER_BAND_LOW_SHELF);
+ else if (band == EQ_NUM_BANDS - 1)
+ return str(LANG_EQUALIZER_BAND_HIGH_SHELF);
+ else
+ {
+ snprintf(buffer, MAX_PATH, str(LANG_EQUALIZER_BAND_PEAK), band);
+ return buffer;
+ }
+ break;
+ case 1: /* cutoff */
+ if (band == 0)
+ lang = str(LANG_EQUALIZER_BAND_CUTOFF);
+ else if (band == EQ_NUM_BANDS - 1)
+ lang = str(LANG_EQUALIZER_BAND_CUTOFF);
+ else
+ lang = str(LANG_EQUALIZER_BAND_CENTER);
+ break;
+ case 2: /* Q */
+ lang = str(LANG_EQUALIZER_BAND_Q);
+ break;
+ case 3: /* Gain */
+ lang = str(LANG_GAIN);
+ break;
+ }
+
+ return strcat(buffer, lang);;
+}
+
+static int advancedmenu_speak_item(int selected_item, void *data)
+{
+ (void)data;
+ int band;
+ int item;
+ int lang = -1;
+
+ selection_to_banditem(selected_item, *(intptr_t*)data, &band, &item);
+
+ switch (item)
+ {
+ case 0: /* Band title */
+ if (band == 0)
+ lang = LANG_EQUALIZER_BAND_LOW_SHELF;
+ else if (band == EQ_NUM_BANDS - 1)
+ lang = LANG_EQUALIZER_BAND_HIGH_SHELF;
+ else
+ {
+ talk_id(LANG_EQUALIZER_BAND_PEAK, false);
+ talk_number(band, true);
+ return -1;
+ }
+ break;
+ case 1: /* cutoff */
+ if (band == 0)
+ lang = LANG_EQUALIZER_BAND_CUTOFF;
+ else if (band == EQ_NUM_BANDS - 1)
+ lang = LANG_EQUALIZER_BAND_CUTOFF;
+ else
+ lang = LANG_EQUALIZER_BAND_CENTER;
+ break;
+ case 2: /* Q */
+ lang = LANG_EQUALIZER_BAND_Q;
+ break;
+ case 3: /* Gain */
+ lang = LANG_GAIN;
+ break;
+ }
+ talk_id(lang, true);
+ return -1;
+}
+
+static enum themable_icons advancedmenu_get_icon(int selected_item, void * data)
+{
+ (void)data;
+ int band;
+ int item;
+
+ selection_to_banditem(selected_item, *(intptr_t*)data, &band, &item);
+
+ if (item == 0)
+ return Icon_Submenu;
+ else
+ return Icon_Menu_setting;
+}
+extern struct eq_band_setting eq_defaults[EQ_NUM_BANDS];
+
+static int eq_do_advanced_menu(void * param)
+{
+ (void)param;
+ struct simplelist_info info;
+ struct settings_list setting;
+ char title[MAX_PATH];
+ int band, item;
+ intptr_t selected_band = -1;
+
+ simplelist_info_init(&info, str(LANG_EQUALIZER_ADVANCED),
+ EQ_NUM_BANDS, &selected_band);
+ info.get_name = (list_get_name*)advancedmenu_item_get_name;
+ info.get_talk = advancedmenu_speak_item;
+ info.get_icon = advancedmenu_get_icon;
+ info.action_callback = simplelist_action_callback;
+ info.selection = -1;
+ info.title_icon = Icon_EQ;
+ setting.flags = F_BANFROMQS|F_INT_SETTING|F_T_INT|F_NO_WRAP;
+
+ while (true)
+ {
+ simplelist_show_list(&info);
+ if (info.selection < 0)
+ break;
+ selection_to_banditem(info.selection, selected_band, &band, &item);
+ switch (item)
+ {
+ case 0: /* title, do nothing */
+ {
+ int extra;
+ if (selected_band == band)
+ {
+ extra = 0;
+ selected_band = -1;
+ }
+ else
+ {
+ extra = 3;
+ selected_band = band;
+ }
+ info.selection = band;
+ info.count = EQ_NUM_BANDS + extra;
+ continue;
+ }
+ case 1: /* cutoff */
+ if (band == 0 || band == EQ_NUM_BANDS - 1)
+ setting.lang_id = LANG_EQUALIZER_BAND_CUTOFF;
+ else
+ setting.lang_id = LANG_EQUALIZER_BAND_CENTER;
+ setting.default_val.int_ = eq_defaults[band].cutoff;
+ setting.int_setting = &cutoff_int_setting;
+ break;
+ case 2: /* Q */
+ setting.lang_id = LANG_EQUALIZER_BAND_Q;
+ setting.default_val.int_ = eq_defaults[band].q;
+ setting.int_setting = &q_int_setting;
+ break;
+ case 3: /* Gain */
+ setting.lang_id = LANG_GAIN;
+ setting.default_val.int_ = eq_defaults[band].gain;
+ setting.int_setting = &gain_int_setting;
+ break;
+ }
+ pcmbuf_set_low_latency(true);
+ setting.setting = &global_settings.eq_band_settings[band].gain;
+ advancedmenu_item_get_name(info.selection, &selected_band, title, MAX_PATH);
+
+ option_screen(&setting, NULL, false, title[0] == '\t' ? &title[1] : title);
+ eq_apply();
+ pcmbuf_set_low_latency(false);
+ }
+ return 0;
+}
+MENUITEM_FUNCTION(advanced_menu, 0, ID2P(LANG_EQUALIZER_ADVANCED),
+ eq_do_advanced_menu, NULL, NULL, Icon_EQ);
enum eq_slider_mode {
GAIN,
@@ -361,12 +440,12 @@ static int draw_eq_slider(struct screen * screen, int x, int y,
steps = EQ_Q_MAX - EQ_Q_MIN;
min_item = q - EQ_Q_STEP - EQ_Q_MIN;
max_item = q + EQ_Q_STEP - EQ_Q_MIN;
- break;
+ break;
case CUTOFF:
steps = EQ_CUTOFF_MAX - EQ_CUTOFF_MIN;
min_item = cutoff - EQ_CUTOFF_FAST_STEP * 2;
max_item = cutoff + EQ_CUTOFF_FAST_STEP * 2;
- break;
+ break;
case GAIN:
default:
steps = EQ_GAIN_MAX - EQ_GAIN_MIN;
@@ -383,7 +462,7 @@ static int draw_eq_slider(struct screen * screen, int x, int y,
if (band == 0) {
screen->putsxy(x1, y1, "LS: ");
screen->getstringsize("LS:", &w, &h);
- } else if (band == 9) {
+ } else if (band == EQ_NUM_BANDS - 1) {
screen->putsxy(x1, y1, "HS: ");
screen->getstringsize("HS:", &w, &h);
} else {
@@ -425,7 +504,7 @@ static int draw_eq_slider(struct screen * screen, int x, int y,
screen->set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID);
else
screen->set_drawmode(DRMODE_SOLID);
-
+
snprintf(buf, sizeof(buf), "%5d%s", cutoff,
screen->lcdwidth >= 160 ? "Hz" : "");
screen->getstringsize(buf, &w, &h);
@@ -453,9 +532,9 @@ static void draw_eq_sliders(struct screen * screen, int x, int y,
{
int height = y;
- start_item = MIN(start_item, 10 - nb_eq_sliders);
+ start_item = MIN(start_item, EQ_NUM_BANDS - nb_eq_sliders);
- for (int i = 0; i < 10; i++) {
+ for (int i = 0; i < EQ_NUM_BANDS; i++) {
struct eq_band_setting *setting = &global_settings.eq_band_settings[i];
int cutoff = setting->cutoff;
int q = setting->q;
@@ -473,9 +552,9 @@ static void draw_eq_sliders(struct screen * screen, int x, int y,
}
}
- if (nb_eq_sliders != 10)
+ if (nb_eq_sliders != EQ_NUM_BANDS)
gui_scrollbar_draw(screen, 0, y, SCROLLBAR_SIZE - 1,
- screen->lcdheight - y, 10,
+ screen->lcdheight - y, EQ_NUM_BANDS,
start_item, start_item + nb_eq_sliders,
VERTICAL);
return;
@@ -514,16 +593,16 @@ bool eq_menu_graphical(void)
if (height > screens[i].lcdheight)
nb_eq_sliders[i]--;
- if (nb_eq_sliders[i] > 10)
- nb_eq_sliders[i] = 10;
+ if (nb_eq_sliders[i] > EQ_NUM_BANDS)
+ nb_eq_sliders[i] = EQ_NUM_BANDS;
}
y = h + 1;
-
+
/* Start off editing gain on the first band */
mode = GAIN;
current_band = 0;
-
+
while (!exit_request) {
FOR_NB_SCREENS(i)
{
@@ -538,7 +617,7 @@ bool eq_menu_graphical(void)
fast_step = EQ_GAIN_FAST_STEP;
min = EQ_GAIN_MIN;
max = EQ_GAIN_MAX;
-
+
snprintf(buf, sizeof(buf), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE),
str(LANG_SYSFONT_GAIN), "(dB)");
@@ -572,12 +651,12 @@ bool eq_menu_graphical(void)
}
/* Draw scrollbar if needed */
- if (nb_eq_sliders[i] != 10)
+ if (nb_eq_sliders[i] != EQ_NUM_BANDS)
{
if (current_band == 0) {
start_item = 0;
} else if (current_band == 9) {
- start_item = 10 - nb_eq_sliders[i];
+ start_item = EQ_NUM_BANDS - nb_eq_sliders[i];
} else {
start_item = current_band - 1;
}
@@ -592,7 +671,7 @@ bool eq_menu_graphical(void)
screens[i].update();
}
-
+
button = get_action(CONTEXT_SETTINGS_EQ,TIMEOUT_BLOCK);
switch (button) {
@@ -630,14 +709,12 @@ bool eq_menu_graphical(void)
case ACTION_STD_PREVREPEAT:
current_band--;
if (current_band < 0)
- current_band = 9; /* wrap around */
+ current_band = EQ_NUM_BANDS - 1; /* wrap around */
break;
case ACTION_STD_NEXT:
case ACTION_STD_NEXTREPEAT:
- current_band++;
- if (current_band > 9)
- current_band = 0; /* wrap around */
+ current_band = (current_band + 1) % EQ_NUM_BANDS;
break;
case ACTION_STD_OK:
@@ -657,7 +734,7 @@ bool eq_menu_graphical(void)
}
break;
}
-
+
/* Update the filter if the user changed something */
if (has_changed) {
dsp_set_eq_coefs(current_band,
@@ -667,7 +744,7 @@ bool eq_menu_graphical(void)
}
/* Reset screen settings */
- FOR_NB_SCREENS(i)
+ FOR_NB_SCREENS(i)
{
screens[i].setfont(FONT_UI);
screens[i].clear_display();
@@ -682,19 +759,18 @@ static bool eq_save_preset(void)
/* make sure that the eq is enabled for setting saving */
bool enabled = global_settings.eq_enabled;
global_settings.eq_enabled = true;
-
+
bool result = settings_save_config(SETTINGS_SAVE_EQPRESET);
-
+
global_settings.eq_enabled = enabled;
return result;
}
-
/* Allows browsing of preset files */
static struct browse_folder_info eqs = { EQS_DIR, SHOW_CFG };
MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL),
- (int(*)(void))eq_menu_graphical, NULL, lowlatency_callback,
+ (int(*)(void))eq_menu_graphical, NULL, lowlatency_callback,
Icon_EQ);
MENUITEM_FUNCTION(eq_save, 0, ID2P(LANG_EQUALIZER_SAVE),
(int(*)(void))eq_save_preset, NULL, NULL, Icon_NOICON);
@@ -703,6 +779,6 @@ MENUITEM_FUNCTION(eq_browse, MENU_FUNC_USEPARAM, ID2P(LANG_EQUALIZER_BROWSE),
Icon_NOICON);
MAKE_MENU(equalizer_menu, ID2P(LANG_EQUALIZER), NULL, Icon_EQ,
- &eq_enable, &eq_graphical, &eq_precut, &gain_menu,
- &advanced_eq_menu_, &eq_save, &eq_browse);
+ &eq_enable, &eq_graphical, &eq_precut, &gain_menu,
+ &advanced_menu, &eq_save, &eq_browse);
diff --git a/apps/plugins/settings_dumper.c b/apps/plugins/settings_dumper.c
index 381cdeebaa..66bfa65b0f 100644
--- a/apps/plugins/settings_dumper.c
+++ b/apps/plugins/settings_dumper.c
@@ -37,6 +37,8 @@ static void write_setting(const struct settings_list *setting, int fd, unsigned
F_EQSETTING|
F_SOUNDSETTING)))
return;
+ else if (setting->flags&F_DEPRECATED)
+ return;
setting_count++;
if (setting_count%10 == 0)
rb->fdprintf(fd, "\r\n");
diff --git a/apps/settings.c b/apps/settings.c
index e2a6efa3d8..1bb6c74b43 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -547,6 +547,8 @@ static bool settings_write_config(const char* filename, int options)
if (settings[i].cfg_name == NULL)
continue;
value[0] = '\0';
+ if (settings[i].flags & F_DEPRECATED)
+ continue;
switch (options)
{
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 2b27516d1c..cc4012ec14 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -470,6 +470,66 @@ static int32_t get_precut_talkid(int value, int unit)
return TALK_ID_DECIMAL(-value, 1, unit);
}
+struct eq_band_setting eq_defaults[EQ_NUM_BANDS] = {
+ { 32, 7, 0 },
+ { 64, 10, 0 },
+ { 125, 10, 0 },
+ { 250, 10, 0 },
+ { 500, 10, 0 },
+ { 1000, 10, 0 },
+ { 2000, 10, 0 },
+ { 4000, 10, 0 },
+ { 8000, 10, 0 },
+ { 16000, 7, 0 },
+};
+
+static void eq_load_from_cfg(void *setting, char *value)
+{
+ struct eq_band_setting *eq = setting;
+ char *val_end, *end;
+
+ val_end = value + strlen(value);
+
+ /* cutoff/center */
+ end = strchr(value, ',');
+ if (!end) return;
+ *end = '\0';
+ eq->cutoff = atoi(value);
+
+ /* q */
+ value = end + 1;
+ if (value > val_end) return;
+ end = strchr(value, ',');
+ if (!end) return;
+ *end = '\0';
+ eq->q = atoi(value);
+
+ /* gain */
+ value = end + 1;
+ if (value > val_end) return;
+ eq->gain = atoi(value);
+}
+
+static char* eq_write_to_cfg(void *setting, char *buf, int buf_len)
+{
+ struct eq_band_setting *eq = setting;
+
+ snprintf(buf, buf_len, "%d, %d, %d", eq->cutoff, eq->q, eq->gain);
+ return buf;
+}
+
+static bool eq_is_changed(void *setting, void *defaultval)
+{
+ struct eq_band_setting *eq = setting;
+
+ return memcmp(eq, defaultval, sizeof(struct eq_band_setting));
+}
+
+static void eq_set_default(void* setting, void* defaultval)
+{
+ memcpy(setting, defaultval, sizeof(struct eq_band_setting));
+}
+
#endif
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
static void set_mdb_enable(bool value)
@@ -1435,103 +1495,122 @@ const struct settings_list settings[] = {
/* equalizer */
OFFON_SETTING(F_EQSETTING, eq_enabled, LANG_EQUALIZER_ENABLED, false,
"eq enabled", NULL),
+
INT_SETTING_NOWRAP(F_EQSETTING, eq_precut, LANG_EQUALIZER_PRECUT, 0,
"eq precut", UNIT_DB, 0, 240, 5, eq_precut_format,
get_precut_talkid, dsp_set_eq_precut),
+
/* 0..32768 Hz */
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[0].cutoff, LANG_EQUALIZER_BAND_CUTOFF,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[0].cutoff, LANG_EQUALIZER_BAND_CUTOFF,
32, "eq band 0 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[1].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[1].cutoff, LANG_EQUALIZER_BAND_CENTER,
64, "eq band 1 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[2].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[2].cutoff, LANG_EQUALIZER_BAND_CENTER,
125, "eq band 2 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[3].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[3].cutoff, LANG_EQUALIZER_BAND_CENTER,
250, "eq band 3 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[4].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[4].cutoff, LANG_EQUALIZER_BAND_CENTER,
500, "eq band 4 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[5].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[5].cutoff, LANG_EQUALIZER_BAND_CENTER,
1000, "eq band 5 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[6].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[6].cutoff, LANG_EQUALIZER_BAND_CENTER,
2000, "eq band 6 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[7].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[7].cutoff, LANG_EQUALIZER_BAND_CENTER,
4000, "eq band 7 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[8].cutoff, LANG_EQUALIZER_BAND_CENTER,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[8].cutoff, LANG_EQUALIZER_BAND_CENTER,
8000, "eq band 8 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[9].cutoff, LANG_EQUALIZER_BAND_CUTOFF,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[9].cutoff, LANG_EQUALIZER_BAND_CUTOFF,
16000, "eq band 9 cutoff", UNIT_HERTZ, EQ_CUTOFF_MIN,
EQ_CUTOFF_MAX, EQ_CUTOFF_STEP, NULL, NULL, NULL),
/* 0..64 (or 0.0 to 6.4) */
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[0].q, LANG_EQUALIZER_BAND_Q, 7,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[0].q, LANG_EQUALIZER_BAND_Q, 7,
"eq band 0 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[1].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[1].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 1 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[2].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[2].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 2 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[3].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[3].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 3 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[4].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[4].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 4 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[5].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[5].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 5 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[6].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[6].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 6 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[7].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[7].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 7 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[8].q, LANG_EQUALIZER_BAND_Q, 10,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[8].q, LANG_EQUALIZER_BAND_Q, 10,
"eq band 8 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[9].q, LANG_EQUALIZER_BAND_Q, 7,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[9].q, LANG_EQUALIZER_BAND_Q, 7,
"eq band 9 q", UNIT_INT, EQ_Q_MIN, EQ_Q_MAX, EQ_Q_STEP,
eq_q_format, get_dec_talkid, NULL),
/* -240..240 (or -24db to +24db) */
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[0].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[0].gain, LANG_GAIN, 0,
"eq band 0 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[1].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[1].gain, LANG_GAIN, 0,
"eq band 1 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[2].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[2].gain, LANG_GAIN, 0,
"eq band 2 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[3].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[3].gain, LANG_GAIN, 0,
"eq band 3 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[4].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[4].gain, LANG_GAIN, 0,
"eq band 4 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[5].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[5].gain, LANG_GAIN, 0,
"eq band 5 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[6].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[6].gain, LANG_GAIN, 0,
"eq band 6 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[7].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[7].gain, LANG_GAIN, 0,
"eq band 7 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[8].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[8].gain, LANG_GAIN, 0,
"eq band 8 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
- INT_SETTING_NOWRAP(F_EQSETTING, eq_band_settings[9].gain, LANG_GAIN, 0,
+ INT_SETTING_NOWRAP(F_DEPRECATED|F_EQSETTING, eq_band_settings[9].gain, LANG_GAIN, 0,
"eq band 9 gain", UNIT_DB, EQ_GAIN_MIN, EQ_GAIN_MAX,
EQ_GAIN_STEP, db_format, get_dec_talkid, NULL),
+#define EQ_BAND(id, string) \
+ CUSTOM_SETTING(F_EQSETTING, eq_band_settings[id], -1, \
+ &eq_defaults[id], string, \
+ eq_load_from_cfg, eq_write_to_cfg, \
+ eq_is_changed, eq_set_default)
+ EQ_BAND(0, "eq low shelf filter"),
+ EQ_BAND(1, "eq peak filter 1"),
+ EQ_BAND(2, "eq peak filter 2"),
+ EQ_BAND(3, "eq peak filter 3"),
+ EQ_BAND(4, "eq peak filter 4"),
+ EQ_BAND(5, "eq peak filter 5"),
+ EQ_BAND(6, "eq peak filter 6"),
+ EQ_BAND(7, "eq peak filter 7"),
+ EQ_BAND(8, "eq peak filter 8"),
+ EQ_BAND(9, "eq high shelf filter"),
+#undef EQ_BAND
+
/* dithering */
OFFON_SETTING(F_SOUNDSETTING, dithering_enabled, LANG_DITHERING, false,
"dithering enabled", dsp_dither_enable),
diff --git a/apps/settings_list.h b/apps/settings_list.h
index 5cefcf6dc2..66b20ca6ca 100644
--- a/apps/settings_list.h
+++ b/apps/settings_list.h
@@ -152,10 +152,10 @@ struct custom_setting {
#define F_PADTITLE 0x800 /* pad the title with spaces to force it to scroll */
#define F_NO_WRAP 0x1000 /* used if the list should not wrap */
-#define F_BANFROMQS 0x80000000 /* ban the setting from the quickscreen items */
-
+#define F_BANFROMQS 0x80000000 /* ban the setting from the quickscreen items */
+#define F_DEPRECATED 0x40000000 /* DEPRECATED setting, don't write to .cfg */
struct settings_list {
- uint32_t flags; /* B___ _SER TFFF NNN_ _ATW PTVC IFRB STTT */
+ uint32_t flags; /* BD__ _SER TFFF NNN_ _ATW PTVC IFRB STTT */
void *setting;
int lang_id; /* -1 for none */
union storage_type default_val;