Rockbox Development > Feature Ideas

Reset EQ

(1/1)

rockbox_dev123:
I think it would be useful to have an option in the Equalizer to reset the EQ to its default settings. Currently I believe this can only be done by saving the default config before making changes and then reloading it later.

It's possibly within my ability to add this feature as a PR.

Mainly looking to get some feedback on if anyone else thinks it would be useful?

rockbox_dev123:

--- Code: ---diff --git a/apps/lang/english.lang b/apps/lang/english.lang
index dd499432fb..db674211b8 100644
--- a/apps/lang/english.lang
+++ b/apps/lang/english.lang
@@ -950,6 +950,20 @@
     *: "Equalizer"
   </voice>
 </phrase>
+<phrase>
+  id: LANG_RESET_EQUALIZER
+  desc: in the equalizer settings menu
+  user: core
+  <source>
+    *: "Reset EQ"
+  </source>
+  <dest>
+    *: "Reset EQ"
+  </dest>
+  <voice>
+    *: "Reset EQ"
+  </voice>
+</phrase>
 <phrase>
   id: LANG_EQUALIZER_ENABLED
   desc: in the equalizer settings menu

--- End code ---


--- Code: ---diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c
index 6c6d356706..b14b38e029 100644
--- a/apps/menus/eq_menu.c
+++ b/apps/menus/eq_menu.c
@@ -782,14 +782,26 @@ static int eq_save_preset(void)
 /* Allows browsing of preset files */
 static struct browse_folder_info eqs = { EQS_DIR, SHOW_CFG };
 
+static void eq_reset_defaults(void)
+{
+    for (int i = 0; i < EQ_NUM_BANDS; i++) {
+        global_settings.eq_band_settings[i].cutoff = eq_defaults[i].cutoff;
+        global_settings.eq_band_settings[i].q = eq_defaults[i].q;
+        global_settings.eq_band_settings[i].gain = eq_defaults[i].gain;
+    }
+    eq_apply();
+}
+
 MENUITEM_FUNCTION(eq_graphical, 0, ID2P(LANG_EQUALIZER_GRAPHICAL),
                   eq_menu_graphical, lowlatency_callback, Icon_EQ);
 MENUITEM_FUNCTION(eq_save, 0, ID2P(LANG_EQUALIZER_SAVE),
                   eq_save_preset, NULL, Icon_NOICON);
+MENUITEM_FUNCTION(eq_reset, 0, ID2P(LANG_RESET_EQUALIZER),
+                  eq_reset_defaults, NULL, Icon_NOICON);
 MENUITEM_FUNCTION_W_PARAM(eq_browse, 0, ID2P(LANG_EQUALIZER_BROWSE),
                           browse_folder, (void*)&eqs,
                           lowlatency_callback, Icon_NOICON);
 
 MAKE_MENU(equalizer_menu, ID2P(LANG_EQUALIZER), NULL, Icon_EQ,
         &eq_enable, &eq_graphical, &eq_precut, &gain_menu,
-        &advanced_menu, &eq_save, &eq_browse);
+        &advanced_menu, &eq_save, &eq_browse, &eq_reset);

--- End code ---

Can someone give me some feedback on this before I submit a proper branch to Gerrit? It works fine.

dconrad:
It's hard to evaluate code just from a diff, but seems reasonable enough! Push it to Gerrit and it's a lot easier to evaluate. Don't worry, you can just re-push it with any changes if need be.

rockbox_dev123:

--- Quote from: dconrad on October 14, 2024, 07:37:05 PM ---It's hard to evaluate code just from a diff, but seems reasonable enough! Push it to Gerrit and it's a lot easier to evaluate. Don't worry, you can just re-push it with any changes if need be.

--- End quote ---

Thanks. Submitted as https://gerrit.rockbox.org/r/c/rockbox/+/5978

Navigation

[0] Message Index

Go to full version