1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * $Id: eq_menu.c 12179 2007-02-01 23:08:15Z amiconn $
10 * Copyright (C) 2006 Dan Everton
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
30 #include "mp3_playback.h"
32 #include "statusbar.h"
45 #include "screen_access.h"
47 #include "gui/scrollbar.h"
59 void eq_gain_format(char* buffer
, int buffer_size
, int value
, const char* unit
)
63 snprintf(buffer
, buffer_size
, "%s%d.%d %s", value
< 0 ? "-" : "",
64 v
/ EQ_USER_DIVISOR
, v
% EQ_USER_DIVISOR
, unit
);
67 void eq_q_format(char* buffer
, int buffer_size
, int value
, const char* unit
)
69 snprintf(buffer
, buffer_size
, "%d.%d %s", value
/ EQ_USER_DIVISOR
, value
% EQ_USER_DIVISOR
, unit
);
72 void eq_precut_format(char* buffer
, int buffer_size
, int value
, const char* unit
)
74 snprintf(buffer
, buffer_size
, "%s%d.%d %s", value
== 0 ? " " : "-",
75 value
/ EQ_USER_DIVISOR
, value
% EQ_USER_DIVISOR
, unit
);
81 int enable_callback(int action
, const struct menu_item_ex
*this_item
)
85 if (action
== ACTION_EXIT_MENUITEM
)
87 dsp_set_eq(global_settings
.eq_enabled
);
88 dsp_set_eq_precut(global_settings
.eq_precut
);
89 /* Update all bands */
90 for(i
= 0; i
< 5; i
++) {
96 MENUITEM_SETTING(eq_enable
, &global_settings
.eq_enabled
, enable_callback
);
97 MENUITEM_SETTING(eq_precut
, &global_settings
.eq_precut
, NULL
);
99 int dsp_set_coefs_callback(int action
, const struct menu_item_ex
*this_item
)
102 if (action
== ACTION_EXIT_MENUITEM
)
104 /* for now, set every band... figure out a better way later */
112 char* gainitem_get_name(int selected_item
, void * data
, char *buffer
)
115 int *setting
= (int*)data
;
116 snprintf(buffer
, MAX_PATH
, str(LANG_EQUALIZER_GAIN_ITEM
), *setting
);
120 int do_option(void* param
)
122 const struct menu_item_ex
*setting
= (const struct menu_item_ex
*)param
;
123 do_setting_from_menu(setting
);
127 MENUITEM_SETTING(cutoff_0
, &global_settings
.eq_band0_cutoff
, dsp_set_coefs_callback
);
128 MENUITEM_SETTING(cutoff_1
, &global_settings
.eq_band1_cutoff
, dsp_set_coefs_callback
);
129 MENUITEM_SETTING(cutoff_2
, &global_settings
.eq_band2_cutoff
, dsp_set_coefs_callback
);
130 MENUITEM_SETTING(cutoff_3
, &global_settings
.eq_band3_cutoff
, dsp_set_coefs_callback
);
131 MENUITEM_SETTING(cutoff_4
, &global_settings
.eq_band4_cutoff
, dsp_set_coefs_callback
);
133 MENUITEM_SETTING(q_0
, &global_settings
.eq_band0_q
, dsp_set_coefs_callback
);
134 MENUITEM_SETTING(q_1
, &global_settings
.eq_band1_q
, dsp_set_coefs_callback
);
135 MENUITEM_SETTING(q_2
, &global_settings
.eq_band2_q
, dsp_set_coefs_callback
);
136 MENUITEM_SETTING(q_3
, &global_settings
.eq_band3_q
, dsp_set_coefs_callback
);
137 MENUITEM_SETTING(q_4
, &global_settings
.eq_band4_q
, dsp_set_coefs_callback
);
139 MENUITEM_SETTING(gain_0
, &global_settings
.eq_band0_gain
, dsp_set_coefs_callback
);
140 MENUITEM_SETTING(gain_1
, &global_settings
.eq_band1_gain
, dsp_set_coefs_callback
);
141 MENUITEM_SETTING(gain_2
, &global_settings
.eq_band2_gain
, dsp_set_coefs_callback
);
142 MENUITEM_SETTING(gain_3
, &global_settings
.eq_band3_gain
, dsp_set_coefs_callback
);
143 MENUITEM_SETTING(gain_4
, &global_settings
.eq_band4_gain
, dsp_set_coefs_callback
);
145 MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_0
, do_option
, (void*)&gain_0
, NULL
,
147 &global_settings
.eq_band0_cutoff
, Icon_NOICON
);
148 MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_1
, do_option
, (void*)&gain_1
, NULL
,
150 &global_settings
.eq_band1_cutoff
, Icon_NOICON
);
151 MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_2
, do_option
, (void*)&gain_2
, NULL
,
153 &global_settings
.eq_band2_cutoff
, Icon_NOICON
);
154 MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_3
, do_option
, (void*)&gain_3
, NULL
,
156 &global_settings
.eq_band3_cutoff
, Icon_NOICON
);
157 MENUITEM_FUNCTION_WPARAM_DYNTEXT(gain_item_4
, do_option
, (void*)&gain_4
, NULL
,
159 &global_settings
.eq_band4_cutoff
, Icon_NOICON
);
161 MAKE_MENU(gain_menu
, ID2P(LANG_EQUALIZER_GAIN
), NULL
, Icon_NOICON
, &gain_item_0
,
162 &gain_item_1
, &gain_item_2
, &gain_item_3
, &gain_item_4
);
164 static const struct menu_item_ex
*band_items
[3][3] = {
165 { &cutoff_1
, &q_1
, &gain_1
},
166 { &cutoff_2
, &q_2
, &gain_2
},
167 { &cutoff_3
, &q_3
, &gain_3
}
169 char* centerband_get_name(int selected_item
, void * data
, char *buffer
)
172 int band
= (intptr_t)data
;
173 snprintf(buffer
, MAX_PATH
, str(LANG_EQUALIZER_BAND_PEAK
), band
);
176 int do_center_band_menu(void* param
)
178 int band
= (intptr_t)param
;
179 struct menu_item_ex menu
;
180 struct menu_callback_with_desc cb_and_desc
;
183 cb_and_desc
.menu_callback
= NULL
;
184 snprintf(desc
, MAX_PATH
, str(LANG_EQUALIZER_BAND_PEAK
), band
);
185 cb_and_desc
.desc
= desc
;
186 cb_and_desc
.icon_id
= Icon_EQ
;
187 menu
.flags
= MT_MENU
|(3<<MENU_COUNT_SHIFT
)|MENU_HAS_DESC
;
188 menu
.submenus
= band_items
[band
-1];
189 menu
.callback_and_desc
= &cb_and_desc
;
190 do_menu(&menu
, NULL
);
193 MAKE_MENU(band_0_menu
, ID2P(LANG_EQUALIZER_BAND_LOW_SHELF
), NULL
,
194 Icon_EQ
, &cutoff_0
, &q_0
, &gain_0
);
195 MENUITEM_FUNCTION_WPARAM_DYNTEXT(band_1_menu
, do_center_band_menu
, (void*)1, NULL
,
196 centerband_get_name
, (void*)1, Icon_EQ
);
197 MENUITEM_FUNCTION_WPARAM_DYNTEXT(band_2_menu
, do_center_band_menu
, (void*)2, NULL
,
198 centerband_get_name
, (void*)2, Icon_EQ
);
199 MENUITEM_FUNCTION_WPARAM_DYNTEXT(band_3_menu
, do_center_band_menu
, (void*)3, NULL
,
200 centerband_get_name
, (void*)3, Icon_EQ
);
201 MAKE_MENU(band_4_menu
, ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF
), NULL
,
202 Icon_EQ
, &cutoff_4
, &q_4
, &gain_4
);
204 MAKE_MENU(advanced_eq_menu_
, ID2P(LANG_EQUALIZER_ADVANCED
), NULL
, Icon_EQ
,
205 &band_0_menu
, &band_1_menu
, &band_2_menu
, &band_3_menu
, &band_4_menu
);
208 enum eq_slider_mode
{
220 /* Draw the UI for a whole EQ band */
221 static int draw_eq_slider(struct screen
* screen
, int x
, int y
,
222 int width
, int cutoff
, int q
, int gain
, bool selected
,
223 enum eq_slider_mode mode
, enum eq_type type
)
226 const char separator
[2] = " ";
227 int steps
, min_item
, max_item
;
228 int abs_gain
= abs(gain
);
229 int current_x
, total_height
, separator_width
, separator_height
;
231 const int slider_height
= 6;
235 steps
= EQ_Q_MAX
- EQ_Q_MIN
;
236 min_item
= q
- EQ_Q_STEP
- EQ_Q_MIN
;
237 max_item
= q
+ EQ_Q_STEP
- EQ_Q_MIN
;
240 steps
= EQ_CUTOFF_MAX
- EQ_CUTOFF_MIN
;
241 min_item
= cutoff
- EQ_CUTOFF_FAST_STEP
* 2;
242 max_item
= cutoff
+ EQ_CUTOFF_FAST_STEP
* 2;
246 steps
= EQ_GAIN_MAX
- EQ_GAIN_MIN
;
247 min_item
= abs(EQ_GAIN_MIN
) + gain
- EQ_GAIN_STEP
* 5;
248 max_item
= abs(EQ_GAIN_MIN
) + gain
+ EQ_GAIN_STEP
* 5;
252 /* Start two pixels in, one for border, one for margin */
255 /* Figure out how large our separator string is */
256 screen
->getstringsize(separator
, &separator_width
, &separator_height
);
258 /* Total height includes margins, text, and line selector */
259 total_height
= separator_height
+ slider_height
+ 2 + 3;
261 /* Print out the band label */
262 if (type
== LOW_SHELF
) {
263 screen
->putsxy(current_x
, y
+ 2, "LS:");
264 screen
->getstringsize("LS:", &w
, &h
);
265 } else if (type
== HIGH_SHELF
) {
266 screen
->putsxy(current_x
, y
+ 2, "HS:");
267 screen
->getstringsize("HS:", &w
, &h
);
269 screen
->putsxy(current_x
, y
+ 2, "PK:");
270 screen
->getstringsize("PK:", &w
, &h
);
274 /* Print separator */
275 screen
->set_drawmode(DRMODE_SOLID
);
276 screen
->putsxy(current_x
, y
+ 2, separator
);
277 current_x
+= separator_width
;
279 if (screen
->screen_type
== SCREEN_REMOTE
) {
281 screen
->putsxy(current_x
, y
+ 2, str(LANG_EQUALIZER_BAND_GAIN
));
282 screen
->getstringsize(str(LANG_EQUALIZER_BAND_GAIN
), &w
, &h
);
283 } else if (mode
== CUTOFF
) {
284 screen
->putsxy(current_x
, y
+ 2, str(LANG_EQUALIZER_BAND_CUTOFF
));
285 screen
->getstringsize(str(LANG_EQUALIZER_BAND_CUTOFF
), &w
, &h
);
287 screen
->putsxy(current_x
, y
+ 2, str(LANG_EQUALIZER_BAND_Q
));
288 screen
->getstringsize(str(LANG_EQUALIZER_BAND_Q
), &w
, &h
);
291 /* Draw horizontal slider. Reuse scrollbar for this */
292 gui_scrollbar_draw(screen
, x
+ 3, y
+ h
+ 3, width
- 6, slider_height
, steps
,
293 min_item
, max_item
, HORIZONTAL
);
295 /* Print out cutoff part */
296 snprintf(buf
, sizeof(buf
), "%sGain %s%2d.%ddB",mode
==GAIN
?" > ":" ", gain
< 0 ? "-" : " ",
297 abs_gain
/ EQ_USER_DIVISOR
, abs_gain
% EQ_USER_DIVISOR
);
298 screen
->getstringsize(buf
, &w
, &h
);
300 screen
->putsxy(0, y
, buf
);
301 /* Print out cutoff part */
302 snprintf(buf
, sizeof(buf
), "%sCutoff %5dHz",mode
==CUTOFF
?" > ":" ", cutoff
);
304 screen
->putsxy(0, y
, buf
);
305 snprintf(buf
, sizeof(buf
), "%sQ setting %d.%d Q",mode
==Q
?" > ":" ", q
/ EQ_USER_DIVISOR
,
306 q
% EQ_USER_DIVISOR
);
308 screen
->putsxy(0, y
, buf
);
313 /* Print out gain part of status line */
314 snprintf(buf
, sizeof(buf
), "%s%2d.%ddB", gain
< 0 ? "-" : " ",
315 abs_gain
/ EQ_USER_DIVISOR
, abs_gain
% EQ_USER_DIVISOR
);
317 if (mode
== GAIN
&& selected
)
318 screen
->set_drawmode(DRMODE_SOLID
| DRMODE_INVERSEVID
);
320 screen
->putsxy(current_x
, y
+ 2, buf
);
321 screen
->getstringsize(buf
, &w
, &h
);
324 /* Print separator */
325 screen
->set_drawmode(DRMODE_SOLID
);
326 screen
->putsxy(current_x
, y
+ 2, separator
);
327 current_x
+= separator_width
;
329 /* Print out cutoff part of status line */
330 snprintf(buf
, sizeof(buf
), "%5dHz", cutoff
);
332 if (mode
== CUTOFF
&& selected
)
333 screen
->set_drawmode(DRMODE_SOLID
| DRMODE_INVERSEVID
);
335 screen
->putsxy(current_x
, y
+ 2, buf
);
336 screen
->getstringsize(buf
, &w
, &h
);
339 /* Print separator */
340 screen
->set_drawmode(DRMODE_SOLID
);
341 screen
->putsxy(current_x
, y
+ 2, separator
);
342 current_x
+= separator_width
;
344 /* Print out Q part of status line */
345 snprintf(buf
, sizeof(buf
), "%d.%d Q", q
/ EQ_USER_DIVISOR
,
346 q
% EQ_USER_DIVISOR
);
348 if (mode
== Q
&& selected
)
349 screen
->set_drawmode(DRMODE_SOLID
| DRMODE_INVERSEVID
);
351 screen
->putsxy(current_x
, y
+ 2, buf
);
352 screen
->getstringsize(buf
, &w
, &h
);
355 screen
->set_drawmode(DRMODE_SOLID
);
357 /* Draw selection box */
359 screen
->drawrect(x
, y
, width
, total_height
);
362 /* Draw horizontal slider. Reuse scrollbar for this */
363 gui_scrollbar_draw(screen
, x
+ 3, y
+ h
+ 3, width
- 6, slider_height
, steps
,
364 min_item
, max_item
, HORIZONTAL
);
369 /* Draw's all the EQ sliders. Returns the total height of the sliders drawn */
370 static int draw_eq_sliders(int current_band
, enum eq_slider_mode mode
)
372 int i
, gain
, q
, cutoff
;
373 int height
= 2; /* Two pixel margin */
374 int slider_width
[NB_SCREENS
];
375 int *setting
= &global_settings
.eq_band0_cutoff
;
379 slider_width
[i
] = screens
[i
].width
- 4; /* two pixel margin on each side */
381 for (i
=0; i
<5; i
++) {
393 height
+= draw_eq_slider(&(screens
[SCREEN_MAIN
]), 2, height
,
394 slider_width
[SCREEN_MAIN
], cutoff
, q
, gain
,
395 i
== current_band
, mode
, type
);
397 if (i
== current_band
)
398 draw_eq_slider(&(screens
[SCREEN_REMOTE
]), 2, 0,
399 slider_width
[SCREEN_REMOTE
], cutoff
, q
, gain
,1, mode
, type
);
408 /* Provides a graphical means of editing the EQ settings */
409 bool eq_menu_graphical(void)
411 bool exit_request
= false;
413 bool has_changed
= false;
416 int current_band
, y
, step
, fast_step
, min
, max
, voice_unit
;
417 enum eq_slider_mode mode
;
418 enum eq_type current_type
;
423 screens
[i
].setfont(FONT_SYSFIXED
);
424 screens
[i
].clear_display();
427 /* Start off editing gain on the first band */
429 current_type
= LOW_SHELF
;
432 while (!exit_request
) {
435 /* Clear the screen. The drawing routines expect this */
436 screens
[i
].clear_display();
437 /* Draw equalizer band details */
438 y
= draw_eq_sliders(current_band
, mode
);
441 /* Set pointer to the band data currently editable */
444 setting
= &global_settings
.eq_band0_gain
;
445 setting
+= current_band
* 3;
448 fast_step
= EQ_GAIN_FAST_STEP
;
451 voice_unit
= UNIT_DB
;
453 snprintf(buf
, sizeof(buf
), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE
),
454 str(LANG_SYSFONT_EQUALIZER_BAND_GAIN
));
456 screens
[SCREEN_MAIN
].putsxy(2, y
, buf
);
457 } else if (mode
== CUTOFF
) {
459 setting
= &global_settings
.eq_band0_cutoff
;
460 setting
+= current_band
* 3;
462 step
= EQ_CUTOFF_STEP
;
463 fast_step
= EQ_CUTOFF_FAST_STEP
;
466 voice_unit
= UNIT_HERTZ
;
468 snprintf(buf
, sizeof(buf
), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE
),
469 str(LANG_SYSFONT_EQUALIZER_BAND_CUTOFF
));
471 screens
[SCREEN_MAIN
].putsxy(2, y
, buf
);
474 setting
= &global_settings
.eq_band0_q
;
475 setting
+= current_band
* 3;
478 fast_step
= EQ_Q_FAST_STEP
;
481 voice_unit
= UNIT_INT
;
483 snprintf(buf
, sizeof(buf
), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE
),
484 str(LANG_EQUALIZER_BAND_Q
));
486 screens
[SCREEN_MAIN
].putsxy(2, y
, buf
);
493 button
= get_action(CONTEXT_SETTINGS_EQ
,TIMEOUT_BLOCK
);
496 case ACTION_SETTINGS_DEC
:
497 case ACTION_SETTINGS_DECREPEAT
:
500 if (*(setting
) < min
)
504 case ACTION_SETTINGS_INC
:
505 case ACTION_SETTINGS_INCREPEAT
:
508 if (*(setting
) > max
)
512 case ACTION_SETTINGS_INCBIGSTEP
:
513 *(setting
) += fast_step
;
515 if (*(setting
) > max
)
519 case ACTION_SETTINGS_DECBIGSTEP
:
520 *(setting
) -= fast_step
;
522 if (*(setting
) < min
)
526 case ACTION_STD_PREV
:
527 case ACTION_STD_PREVREPEAT
:
529 if (current_band
< 0)
530 current_band
= 4; /* wrap around */
533 case ACTION_STD_NEXT
:
534 case ACTION_STD_NEXTREPEAT
:
536 if (current_band
> 4)
537 current_band
= 0; /* wrap around */
543 mode
= GAIN
; /* wrap around */
546 case ACTION_STD_CANCEL
:
552 if(default_event_handler(button
) == SYS_USB_CONNECTED
) {
559 /* Update the filter if the user changed something */
561 dsp_set_eq_coefs(current_band
);
566 action_signalscreenchange();
567 /* Reset screen settings */
569 screens
[i
].setfont(FONT_UI
);
570 screens
[i
].clear_display();
576 * TODO: Can the settings system be used to do this instead?
578 static bool eq_save_preset(void)
581 char filename
[MAX_PATH
];
584 create_numbered_filename(filename
, EQS_DIR
, "eq", ".cfg", 2
585 IF_CNFN_NUM_(, NULL
));
587 /* allow user to modify filename */
589 if (!kbd_input(filename
, sizeof filename
)) {
590 fd
= creat(filename
);
592 gui_syncsplash(HZ
, str(LANG_FAILED
));
597 gui_syncsplash(HZ
, str(LANG_MENU_SETTING_CANCEL
));
602 /* TODO: Should we really do this? */
603 fdprintf(fd
, "eq enabled: on\r\n");
604 fdprintf(fd
, "eq precut: %d\r\n", global_settings
.eq_precut
);
606 setting
= &global_settings
.eq_band0_cutoff
;
608 for(i
= 0; i
< 5; ++i
) {
609 fdprintf(fd
, "eq band %d cutoff: %d\r\n", i
, *setting
++);
610 fdprintf(fd
, "eq band %d q: %d\r\n", i
, *setting
++);
611 fdprintf(fd
, "eq band %d gain: %d\r\n", i
, *setting
++);
616 gui_syncsplash(HZ
, str(LANG_SETTINGS_SAVED
));
621 /* Allows browsing of preset files */
622 bool eq_browse_presets(void)
624 return rockbox_browse(EQS_DIR
, SHOW_CFG
);
628 MENUITEM_FUNCTION(eq_graphical
, ID2P(LANG_EQUALIZER_GRAPHICAL
),
629 (int(*)(void))eq_menu_graphical
, NULL
,
631 MENUITEM_FUNCTION(eq_save
, ID2P(LANG_EQUALIZER_SAVE
),
632 (int(*)(void))eq_save_preset
, NULL
, Icon_NOICON
);
633 MENUITEM_FUNCTION(eq_browse
, ID2P(LANG_EQUALIZER_BROWSE
),
634 (int(*)(void))eq_browse_presets
, NULL
, Icon_NOICON
);
636 MAKE_MENU(equalizer_menu
, ID2P(LANG_EQUALIZER
), NULL
, Icon_EQ
,
637 &eq_enable
, &eq_graphical
, &eq_precut
, &gain_menu
,
638 &advanced_eq_menu_
, &eq_save
, &eq_browse
);
643 void eq_hw_gain_format(char* buffer
, int buffer_size
, int value
,
646 snprintf(buffer
, buffer_size
, "%d %s", value
, unit
);
649 static int band0_callback(int action
, const struct menu_item_ex
*this_item
)
652 if (action
== ACTION_EXIT_MENUITEM
)
655 audiohw_set_equalizer_band(0, global_settings
.eq_hw_band0_cutoff
, 0,
656 global_settings
.eq_hw_band0_gain
);
661 static int band1_callback(int action
, const struct menu_item_ex
*this_item
)
664 if (action
== ACTION_EXIT_MENUITEM
)
667 audiohw_set_equalizer_band(1, global_settings
.eq_hw_band1_center
,
668 global_settings
.eq_hw_band1_bandwidth
,
669 global_settings
.eq_hw_band1_gain
);
674 static int band2_callback(int action
, const struct menu_item_ex
*this_item
)
677 if (action
== ACTION_EXIT_MENUITEM
)
680 audiohw_set_equalizer_band(2, global_settings
.eq_hw_band2_center
,
681 global_settings
.eq_hw_band2_bandwidth
,
682 global_settings
.eq_hw_band2_gain
);
687 static int band3_callback(int action
, const struct menu_item_ex
*this_item
)
690 if (action
== ACTION_EXIT_MENUITEM
)
693 audiohw_set_equalizer_band(3, global_settings
.eq_hw_band3_center
,
694 global_settings
.eq_hw_band3_bandwidth
,
695 global_settings
.eq_hw_band3_gain
);
700 static int band4_callback(int action
, const struct menu_item_ex
*this_item
)
703 if (action
== ACTION_EXIT_MENUITEM
)
706 audiohw_set_equalizer_band(4, global_settings
.eq_hw_band4_cutoff
, 0,
707 global_settings
.eq_hw_band4_gain
);
712 void eq_hw_enable(bool enable
)
718 audiohw_set_equalizer_band(0, global_settings
.eq_hw_band0_cutoff
,
719 0, global_settings
.eq_hw_band0_gain
);
720 audiohw_set_equalizer_band(1, global_settings
.eq_hw_band1_center
,
721 global_settings
.eq_hw_band1_bandwidth
,
722 global_settings
.eq_hw_band1_gain
);
723 audiohw_set_equalizer_band(2, global_settings
.eq_hw_band2_center
,
724 global_settings
.eq_hw_band2_bandwidth
,
725 global_settings
.eq_hw_band2_gain
);
726 audiohw_set_equalizer_band(3, global_settings
.eq_hw_band3_center
,
727 global_settings
.eq_hw_band3_bandwidth
,
728 global_settings
.eq_hw_band3_gain
);
729 audiohw_set_equalizer_band(4, global_settings
.eq_hw_band4_cutoff
,
730 0, global_settings
.eq_hw_band4_gain
);
732 audiohw_set_equalizer_band(0, global_settings
.eq_hw_band0_cutoff
, 0, 0);
733 audiohw_set_equalizer_band(1, global_settings
.eq_hw_band1_center
,
734 global_settings
.eq_hw_band1_bandwidth
, 0);
735 audiohw_set_equalizer_band(2, global_settings
.eq_hw_band2_center
,
736 global_settings
.eq_hw_band2_bandwidth
, 0);
737 audiohw_set_equalizer_band(3, global_settings
.eq_hw_band3_center
,
738 global_settings
.eq_hw_band3_bandwidth
, 0);
739 audiohw_set_equalizer_band(4, global_settings
.eq_hw_band4_cutoff
, 0, 0);
743 static int hweq_enable_callback(int action
, const struct menu_item_ex
*this_item
)
746 if (action
== ACTION_EXIT_MENUITEM
)
748 eq_hw_enable(global_settings
.eq_hw_enabled
);
752 MENUITEM_SETTING(hw_eq_enable
, &global_settings
.eq_hw_enabled
, hweq_enable_callback
);
754 MENUITEM_SETTING(hw_eq_cutoff_0
, &global_settings
.eq_hw_band0_cutoff
, band0_callback
);
755 MENUITEM_SETTING(hw_eq_gain_0
, &global_settings
.eq_hw_band0_gain
, band0_callback
);
756 MAKE_MENU(hw_eq_band0
, ID2P(LANG_EQUALIZER_BAND_LOW_SHELF
), NULL
, Icon_NOICON
,
757 &hw_eq_cutoff_0
, &hw_eq_gain_0
);
759 MENUITEM_SETTING(hw_eq_cutoff_1
, &global_settings
.eq_hw_band1_center
, band1_callback
);
760 MENUITEM_SETTING(hw_eq_bandwidth_1
, &global_settings
.eq_hw_band1_bandwidth
, band1_callback
);
761 MENUITEM_SETTING(hw_eq_gain_1
, &global_settings
.eq_hw_band1_gain
, band1_callback
);
762 MAKE_MENU(hw_eq_band1
, "Peak Filter 1", NULL
, Icon_NOICON
,
763 &hw_eq_cutoff_1
, &hw_eq_bandwidth_1
, &hw_eq_gain_1
);
765 MENUITEM_SETTING(hw_eq_cutoff_2
, &global_settings
.eq_hw_band2_center
, band2_callback
);
766 MENUITEM_SETTING(hw_eq_bandwidth_2
, &global_settings
.eq_hw_band2_bandwidth
, band2_callback
);
767 MENUITEM_SETTING(hw_eq_gain_2
, &global_settings
.eq_hw_band2_gain
, band2_callback
);
768 MAKE_MENU(hw_eq_band2
, "Peak Filter 2", NULL
, Icon_NOICON
,
769 &hw_eq_cutoff_2
, &hw_eq_bandwidth_2
, &hw_eq_gain_2
);
771 MENUITEM_SETTING(hw_eq_cutoff_3
, &global_settings
.eq_hw_band3_center
, band3_callback
);
772 MENUITEM_SETTING(hw_eq_bandwidth_3
, &global_settings
.eq_hw_band3_bandwidth
, band3_callback
);
773 MENUITEM_SETTING(hw_eq_gain_3
, &global_settings
.eq_hw_band3_gain
, band3_callback
);
774 MAKE_MENU(hw_eq_band3
, "Peak Filter 3", NULL
, Icon_NOICON
,
775 &hw_eq_cutoff_3
, &hw_eq_bandwidth_3
, &hw_eq_gain_3
);
777 MENUITEM_SETTING(hw_eq_cutoff_4
, &global_settings
.eq_hw_band4_cutoff
, band4_callback
);
778 MENUITEM_SETTING(hw_eq_gain_4
, &global_settings
.eq_hw_band4_gain
, band4_callback
);
779 MAKE_MENU(hw_eq_band4
, ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF
), NULL
, Icon_NOICON
,
780 &hw_eq_cutoff_4
, &hw_eq_gain_4
);
782 MAKE_MENU(hw_eq_menu
, ID2P(LANG_EQUALIZER_HARDWARE
), NULL
, Icon_EQ
,
783 &hw_eq_enable
, &hw_eq_band0
, &hw_eq_band1
,
784 &hw_eq_band2
, &hw_eq_band3
, &hw_eq_band4
);