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
, size_t 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
, size_t 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
, size_t 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_DYNTEXT(gain_item_0
, MENU_FUNC_USEPARAM
, do_option
, (void*)&gain_0
,
146 gainitem_get_name
, &global_settings
.eq_band0_cutoff
,
148 MENUITEM_FUNCTION_DYNTEXT(gain_item_1
, MENU_FUNC_USEPARAM
, do_option
, (void*)&gain_1
,
149 gainitem_get_name
, &global_settings
.eq_band1_cutoff
,
151 MENUITEM_FUNCTION_DYNTEXT(gain_item_2
, MENU_FUNC_USEPARAM
, do_option
, (void*)&gain_2
,
152 gainitem_get_name
, &global_settings
.eq_band2_cutoff
,
154 MENUITEM_FUNCTION_DYNTEXT(gain_item_3
, MENU_FUNC_USEPARAM
, do_option
, (void*)&gain_3
,
155 gainitem_get_name
, &global_settings
.eq_band3_cutoff
,
157 MENUITEM_FUNCTION_DYNTEXT(gain_item_4
, MENU_FUNC_USEPARAM
, do_option
, (void*)&gain_4
,
158 gainitem_get_name
, &global_settings
.eq_band4_cutoff
,
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_DYNTEXT(band_1_menu
, MENU_FUNC_USEPARAM
,
196 do_center_band_menu
, (void*)1,
197 centerband_get_name
, (void*)1, NULL
, Icon_EQ
);
198 MENUITEM_FUNCTION_DYNTEXT(band_2_menu
, MENU_FUNC_USEPARAM
,
199 do_center_band_menu
, (void*)2,
200 centerband_get_name
, (void*)2, NULL
, Icon_EQ
);
201 MENUITEM_FUNCTION_DYNTEXT(band_3_menu
, MENU_FUNC_USEPARAM
,
202 do_center_band_menu
, (void*)3,
203 centerband_get_name
, (void*)3, NULL
, Icon_EQ
);
204 MAKE_MENU(band_4_menu
, ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF
), NULL
,
205 Icon_EQ
, &cutoff_4
, &q_4
, &gain_4
);
207 MAKE_MENU(advanced_eq_menu_
, ID2P(LANG_EQUALIZER_ADVANCED
), NULL
, Icon_EQ
,
208 &band_0_menu
, &band_1_menu
, &band_2_menu
, &band_3_menu
, &band_4_menu
);
211 enum eq_slider_mode
{
223 /* Draw the UI for a whole EQ band */
224 static int draw_eq_slider(struct screen
* screen
, int x
, int y
,
225 int width
, int cutoff
, int q
, int gain
, bool selected
,
226 enum eq_slider_mode mode
, enum eq_type type
)
229 const char separator
[2] = " ";
230 int steps
, min_item
, max_item
;
231 int abs_gain
= abs(gain
);
232 int current_x
, total_height
, separator_width
, separator_height
;
234 const int slider_height
= 6;
238 steps
= EQ_Q_MAX
- EQ_Q_MIN
;
239 min_item
= q
- EQ_Q_STEP
- EQ_Q_MIN
;
240 max_item
= q
+ EQ_Q_STEP
- EQ_Q_MIN
;
243 steps
= EQ_CUTOFF_MAX
- EQ_CUTOFF_MIN
;
244 min_item
= cutoff
- EQ_CUTOFF_FAST_STEP
* 2;
245 max_item
= cutoff
+ EQ_CUTOFF_FAST_STEP
* 2;
249 steps
= EQ_GAIN_MAX
- EQ_GAIN_MIN
;
250 min_item
= abs(EQ_GAIN_MIN
) + gain
- EQ_GAIN_STEP
* 5;
251 max_item
= abs(EQ_GAIN_MIN
) + gain
+ EQ_GAIN_STEP
* 5;
255 /* Start two pixels in, one for border, one for margin */
258 /* Figure out how large our separator string is */
259 screen
->getstringsize(separator
, &separator_width
, &separator_height
);
261 /* Total height includes margins, text, and line selector */
262 total_height
= separator_height
+ slider_height
+ 2 + 3;
264 /* Print out the band label */
265 if (type
== LOW_SHELF
) {
266 screen
->putsxy(current_x
, y
+ 2, "LS:");
267 screen
->getstringsize("LS:", &w
, &h
);
268 } else if (type
== HIGH_SHELF
) {
269 screen
->putsxy(current_x
, y
+ 2, "HS:");
270 screen
->getstringsize("HS:", &w
, &h
);
272 screen
->putsxy(current_x
, y
+ 2, "PK:");
273 screen
->getstringsize("PK:", &w
, &h
);
277 /* Print separator */
278 screen
->set_drawmode(DRMODE_SOLID
);
279 screen
->putsxy(current_x
, y
+ 2, separator
);
280 current_x
+= separator_width
;
282 if (screen
->screen_type
== SCREEN_REMOTE
) {
284 screen
->putsxy(current_x
, y
+ 2, str(LANG_GAIN
));
285 screen
->getstringsize(str(LANG_GAIN
), &w
, &h
);
286 } else if (mode
== CUTOFF
) {
287 screen
->putsxy(current_x
, y
+ 2, str(LANG_EQUALIZER_BAND_CUTOFF
));
288 screen
->getstringsize(str(LANG_EQUALIZER_BAND_CUTOFF
), &w
, &h
);
290 screen
->putsxy(current_x
, y
+ 2, str(LANG_EQUALIZER_BAND_Q
));
291 screen
->getstringsize(str(LANG_EQUALIZER_BAND_Q
), &w
, &h
);
294 /* Draw horizontal slider. Reuse scrollbar for this */
295 gui_scrollbar_draw(screen
, x
+ 3, y
+ h
+ 3, width
- 6, slider_height
, steps
,
296 min_item
, max_item
, HORIZONTAL
);
298 /* Print out cutoff part */
299 snprintf(buf
, sizeof(buf
), "%sGain %s%2d.%ddB",mode
==GAIN
?" > ":" ", gain
< 0 ? "-" : " ",
300 abs_gain
/ EQ_USER_DIVISOR
, abs_gain
% EQ_USER_DIVISOR
);
301 screen
->getstringsize(buf
, &w
, &h
);
303 screen
->putsxy(0, y
, buf
);
304 /* Print out cutoff part */
305 snprintf(buf
, sizeof(buf
), "%sCutoff %5dHz",mode
==CUTOFF
?" > ":" ", cutoff
);
307 screen
->putsxy(0, y
, buf
);
308 snprintf(buf
, sizeof(buf
), "%sQ setting %d.%d Q",mode
==Q
?" > ":" ", q
/ EQ_USER_DIVISOR
,
309 q
% EQ_USER_DIVISOR
);
311 screen
->putsxy(0, y
, buf
);
316 /* Print out gain part of status line */
317 snprintf(buf
, sizeof(buf
), "%s%2d.%ddB", gain
< 0 ? "-" : " ",
318 abs_gain
/ EQ_USER_DIVISOR
, abs_gain
% EQ_USER_DIVISOR
);
320 if (mode
== GAIN
&& selected
)
321 screen
->set_drawmode(DRMODE_SOLID
| DRMODE_INVERSEVID
);
323 screen
->putsxy(current_x
, y
+ 2, buf
);
324 screen
->getstringsize(buf
, &w
, &h
);
327 /* Print separator */
328 screen
->set_drawmode(DRMODE_SOLID
);
329 screen
->putsxy(current_x
, y
+ 2, separator
);
330 current_x
+= separator_width
;
332 /* Print out cutoff part of status line */
333 snprintf(buf
, sizeof(buf
), "%5dHz", cutoff
);
335 if (mode
== CUTOFF
&& selected
)
336 screen
->set_drawmode(DRMODE_SOLID
| DRMODE_INVERSEVID
);
338 screen
->putsxy(current_x
, y
+ 2, buf
);
339 screen
->getstringsize(buf
, &w
, &h
);
342 /* Print separator */
343 screen
->set_drawmode(DRMODE_SOLID
);
344 screen
->putsxy(current_x
, y
+ 2, separator
);
345 current_x
+= separator_width
;
347 /* Print out Q part of status line */
348 snprintf(buf
, sizeof(buf
), "%d.%d Q", q
/ EQ_USER_DIVISOR
,
349 q
% EQ_USER_DIVISOR
);
351 if (mode
== Q
&& selected
)
352 screen
->set_drawmode(DRMODE_SOLID
| DRMODE_INVERSEVID
);
354 screen
->putsxy(current_x
, y
+ 2, buf
);
355 screen
->getstringsize(buf
, &w
, &h
);
358 screen
->set_drawmode(DRMODE_SOLID
);
360 /* Draw selection box */
362 screen
->drawrect(x
, y
, width
, total_height
);
365 /* Draw horizontal slider. Reuse scrollbar for this */
366 gui_scrollbar_draw(screen
, x
+ 3, y
+ h
+ 3, width
- 6, slider_height
, steps
,
367 min_item
, max_item
, HORIZONTAL
);
372 /* Draw's all the EQ sliders. Returns the total height of the sliders drawn */
373 static int draw_eq_sliders(int current_band
, enum eq_slider_mode mode
)
375 int i
, gain
, q
, cutoff
;
376 int height
= 2; /* Two pixel margin */
377 int slider_width
[NB_SCREENS
];
378 int *setting
= &global_settings
.eq_band0_cutoff
;
382 slider_width
[i
] = screens
[i
].width
- 4; /* two pixel margin on each side */
384 for (i
=0; i
<5; i
++) {
396 height
+= draw_eq_slider(&(screens
[SCREEN_MAIN
]), 2, height
,
397 slider_width
[SCREEN_MAIN
], cutoff
, q
, gain
,
398 i
== current_band
, mode
, type
);
400 if (i
== current_band
)
401 draw_eq_slider(&(screens
[SCREEN_REMOTE
]), 2, 0,
402 slider_width
[SCREEN_REMOTE
], cutoff
, q
, gain
,1, mode
, type
);
411 /* Provides a graphical means of editing the EQ settings */
412 bool eq_menu_graphical(void)
414 bool exit_request
= false;
416 bool has_changed
= false;
419 int current_band
, y
, step
, fast_step
, min
, max
, voice_unit
;
420 enum eq_slider_mode mode
;
421 enum eq_type current_type
;
426 screens
[i
].setfont(FONT_SYSFIXED
);
427 screens
[i
].clear_display();
430 /* Start off editing gain on the first band */
432 current_type
= LOW_SHELF
;
435 while (!exit_request
) {
438 /* Clear the screen. The drawing routines expect this */
439 screens
[i
].clear_display();
440 /* Draw equalizer band details */
441 y
= draw_eq_sliders(current_band
, mode
);
444 /* Set pointer to the band data currently editable */
447 setting
= &global_settings
.eq_band0_gain
;
448 setting
+= current_band
* 3;
451 fast_step
= EQ_GAIN_FAST_STEP
;
454 voice_unit
= UNIT_DB
;
456 snprintf(buf
, sizeof(buf
), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE
),
457 str(LANG_SYSFONT_GAIN
));
459 screens
[SCREEN_MAIN
].putsxy(2, y
, buf
);
460 } else if (mode
== CUTOFF
) {
462 setting
= &global_settings
.eq_band0_cutoff
;
463 setting
+= current_band
* 3;
465 step
= EQ_CUTOFF_STEP
;
466 fast_step
= EQ_CUTOFF_FAST_STEP
;
469 voice_unit
= UNIT_HERTZ
;
471 snprintf(buf
, sizeof(buf
), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE
),
472 str(LANG_SYSFONT_EQUALIZER_BAND_CUTOFF
));
474 screens
[SCREEN_MAIN
].putsxy(2, y
, buf
);
477 setting
= &global_settings
.eq_band0_q
;
478 setting
+= current_band
* 3;
481 fast_step
= EQ_Q_FAST_STEP
;
484 voice_unit
= UNIT_INT
;
486 snprintf(buf
, sizeof(buf
), str(LANG_SYSFONT_EQUALIZER_EDIT_MODE
),
487 str(LANG_EQUALIZER_BAND_Q
));
489 screens
[SCREEN_MAIN
].putsxy(2, y
, buf
);
496 button
= get_action(CONTEXT_SETTINGS_EQ
,TIMEOUT_BLOCK
);
499 case ACTION_SETTINGS_DEC
:
500 case ACTION_SETTINGS_DECREPEAT
:
503 if (*(setting
) < min
)
507 case ACTION_SETTINGS_INC
:
508 case ACTION_SETTINGS_INCREPEAT
:
511 if (*(setting
) > max
)
515 case ACTION_SETTINGS_INCBIGSTEP
:
516 *(setting
) += fast_step
;
518 if (*(setting
) > max
)
522 case ACTION_SETTINGS_DECBIGSTEP
:
523 *(setting
) -= fast_step
;
525 if (*(setting
) < min
)
529 case ACTION_STD_PREV
:
530 case ACTION_STD_PREVREPEAT
:
532 if (current_band
< 0)
533 current_band
= 4; /* wrap around */
536 case ACTION_STD_NEXT
:
537 case ACTION_STD_NEXTREPEAT
:
539 if (current_band
> 4)
540 current_band
= 0; /* wrap around */
546 mode
= GAIN
; /* wrap around */
549 case ACTION_STD_CANCEL
:
555 if(default_event_handler(button
) == SYS_USB_CONNECTED
) {
562 /* Update the filter if the user changed something */
564 dsp_set_eq_coefs(current_band
);
569 /* Reset screen settings */
571 screens
[i
].setfont(FONT_UI
);
572 screens
[i
].clear_display();
578 * TODO: Can the settings system be used to do this instead?
580 static bool eq_save_preset(void)
583 char filename
[MAX_PATH
];
586 create_numbered_filename(filename
, EQS_DIR
, "eq", ".cfg", 2
587 IF_CNFN_NUM_(, NULL
));
589 /* allow user to modify filename */
591 if (!kbd_input(filename
, sizeof filename
)) {
592 fd
= creat(filename
);
594 gui_syncsplash(HZ
, str(LANG_FAILED
));
599 gui_syncsplash(HZ
, str(LANG_CANCEL
));
604 /* TODO: Should we really do this? */
605 fdprintf(fd
, "eq enabled: on\r\n");
606 fdprintf(fd
, "eq precut: %d\r\n", global_settings
.eq_precut
);
608 setting
= &global_settings
.eq_band0_cutoff
;
610 for(i
= 0; i
< 5; ++i
) {
611 fdprintf(fd
, "eq band %d cutoff: %d\r\n", i
, *setting
++);
612 fdprintf(fd
, "eq band %d q: %d\r\n", i
, *setting
++);
613 fdprintf(fd
, "eq band %d gain: %d\r\n", i
, *setting
++);
618 gui_syncsplash(HZ
, str(LANG_SETTINGS_SAVED
));
623 /* Allows browsing of preset files */
624 bool eq_browse_presets(void)
626 return rockbox_browse(EQS_DIR
, SHOW_CFG
);
630 MENUITEM_FUNCTION(eq_graphical
, 0, ID2P(LANG_EQUALIZER_GRAPHICAL
),
631 (int(*)(void))eq_menu_graphical
, NULL
, NULL
,
633 MENUITEM_FUNCTION(eq_save
, 0, ID2P(LANG_EQUALIZER_SAVE
),
634 (int(*)(void))eq_save_preset
, NULL
, NULL
, Icon_NOICON
);
635 MENUITEM_FUNCTION(eq_browse
, 0, ID2P(LANG_EQUALIZER_BROWSE
),
636 (int(*)(void))eq_browse_presets
, NULL
, NULL
, Icon_NOICON
);
638 int soundmenu_callback(int action
,const struct menu_item_ex
*this_item
);
639 MAKE_MENU(equalizer_menu
, ID2P(LANG_EQUALIZER
), soundmenu_callback
, Icon_EQ
,
640 &eq_enable
, &eq_graphical
, &eq_precut
, &gain_menu
,
641 &advanced_eq_menu_
, &eq_save
, &eq_browse
);
646 void eq_hw_gain_format(char* buffer
, size_t buffer_size
, int value
,
649 snprintf(buffer
, buffer_size
, "%d %s", value
, unit
);
652 static int band0_callback(int action
, const struct menu_item_ex
*this_item
)
655 if (action
== ACTION_EXIT_MENUITEM
)
658 audiohw_set_equalizer_band(0, global_settings
.eq_hw_band0_cutoff
, 0,
659 global_settings
.eq_hw_band0_gain
);
664 static int band1_callback(int action
, const struct menu_item_ex
*this_item
)
667 if (action
== ACTION_EXIT_MENUITEM
)
670 audiohw_set_equalizer_band(1, global_settings
.eq_hw_band1_center
,
671 global_settings
.eq_hw_band1_bandwidth
,
672 global_settings
.eq_hw_band1_gain
);
677 static int band2_callback(int action
, const struct menu_item_ex
*this_item
)
680 if (action
== ACTION_EXIT_MENUITEM
)
683 audiohw_set_equalizer_band(2, global_settings
.eq_hw_band2_center
,
684 global_settings
.eq_hw_band2_bandwidth
,
685 global_settings
.eq_hw_band2_gain
);
690 static int band3_callback(int action
, const struct menu_item_ex
*this_item
)
693 if (action
== ACTION_EXIT_MENUITEM
)
696 audiohw_set_equalizer_band(3, global_settings
.eq_hw_band3_center
,
697 global_settings
.eq_hw_band3_bandwidth
,
698 global_settings
.eq_hw_band3_gain
);
703 static int band4_callback(int action
, const struct menu_item_ex
*this_item
)
706 if (action
== ACTION_EXIT_MENUITEM
)
709 audiohw_set_equalizer_band(4, global_settings
.eq_hw_band4_cutoff
, 0,
710 global_settings
.eq_hw_band4_gain
);
715 void eq_hw_enable(bool enable
)
721 audiohw_set_equalizer_band(0, global_settings
.eq_hw_band0_cutoff
,
722 0, global_settings
.eq_hw_band0_gain
);
723 audiohw_set_equalizer_band(1, global_settings
.eq_hw_band1_center
,
724 global_settings
.eq_hw_band1_bandwidth
,
725 global_settings
.eq_hw_band1_gain
);
726 audiohw_set_equalizer_band(2, global_settings
.eq_hw_band2_center
,
727 global_settings
.eq_hw_band2_bandwidth
,
728 global_settings
.eq_hw_band2_gain
);
729 audiohw_set_equalizer_band(3, global_settings
.eq_hw_band3_center
,
730 global_settings
.eq_hw_band3_bandwidth
,
731 global_settings
.eq_hw_band3_gain
);
732 audiohw_set_equalizer_band(4, global_settings
.eq_hw_band4_cutoff
,
733 0, global_settings
.eq_hw_band4_gain
);
735 audiohw_set_equalizer_band(0, global_settings
.eq_hw_band0_cutoff
, 0, 0);
736 audiohw_set_equalizer_band(1, global_settings
.eq_hw_band1_center
,
737 global_settings
.eq_hw_band1_bandwidth
, 0);
738 audiohw_set_equalizer_band(2, global_settings
.eq_hw_band2_center
,
739 global_settings
.eq_hw_band2_bandwidth
, 0);
740 audiohw_set_equalizer_band(3, global_settings
.eq_hw_band3_center
,
741 global_settings
.eq_hw_band3_bandwidth
, 0);
742 audiohw_set_equalizer_band(4, global_settings
.eq_hw_band4_cutoff
, 0, 0);
746 static int hweq_enable_callback(int action
, const struct menu_item_ex
*this_item
)
749 if (action
== ACTION_EXIT_MENUITEM
)
751 eq_hw_enable(global_settings
.eq_hw_enabled
);
755 MENUITEM_SETTING(hw_eq_enable
, &global_settings
.eq_hw_enabled
, hweq_enable_callback
);
757 MENUITEM_SETTING(hw_eq_cutoff_0
, &global_settings
.eq_hw_band0_cutoff
, band0_callback
);
758 MENUITEM_SETTING(hw_eq_gain_0
, &global_settings
.eq_hw_band0_gain
, band0_callback
);
759 MAKE_MENU(hw_eq_band0
, ID2P(LANG_EQUALIZER_BAND_LOW_SHELF
), NULL
, Icon_NOICON
,
760 &hw_eq_cutoff_0
, &hw_eq_gain_0
);
762 MENUITEM_SETTING(hw_eq_cutoff_1
, &global_settings
.eq_hw_band1_center
, band1_callback
);
763 MENUITEM_SETTING(hw_eq_bandwidth_1
, &global_settings
.eq_hw_band1_bandwidth
, band1_callback
);
764 MENUITEM_SETTING(hw_eq_gain_1
, &global_settings
.eq_hw_band1_gain
, band1_callback
);
765 MAKE_MENU(hw_eq_band1
, "Peak Filter 1", NULL
, Icon_NOICON
,
766 &hw_eq_cutoff_1
, &hw_eq_bandwidth_1
, &hw_eq_gain_1
);
768 MENUITEM_SETTING(hw_eq_cutoff_2
, &global_settings
.eq_hw_band2_center
, band2_callback
);
769 MENUITEM_SETTING(hw_eq_bandwidth_2
, &global_settings
.eq_hw_band2_bandwidth
, band2_callback
);
770 MENUITEM_SETTING(hw_eq_gain_2
, &global_settings
.eq_hw_band2_gain
, band2_callback
);
771 MAKE_MENU(hw_eq_band2
, "Peak Filter 2", NULL
, Icon_NOICON
,
772 &hw_eq_cutoff_2
, &hw_eq_bandwidth_2
, &hw_eq_gain_2
);
774 MENUITEM_SETTING(hw_eq_cutoff_3
, &global_settings
.eq_hw_band3_center
, band3_callback
);
775 MENUITEM_SETTING(hw_eq_bandwidth_3
, &global_settings
.eq_hw_band3_bandwidth
, band3_callback
);
776 MENUITEM_SETTING(hw_eq_gain_3
, &global_settings
.eq_hw_band3_gain
, band3_callback
);
777 MAKE_MENU(hw_eq_band3
, "Peak Filter 3", NULL
, Icon_NOICON
,
778 &hw_eq_cutoff_3
, &hw_eq_bandwidth_3
, &hw_eq_gain_3
);
780 MENUITEM_SETTING(hw_eq_cutoff_4
, &global_settings
.eq_hw_band4_cutoff
, band4_callback
);
781 MENUITEM_SETTING(hw_eq_gain_4
, &global_settings
.eq_hw_band4_gain
, band4_callback
);
782 MAKE_MENU(hw_eq_band4
, ID2P(LANG_EQUALIZER_BAND_HIGH_SHELF
), NULL
, Icon_NOICON
,
783 &hw_eq_cutoff_4
, &hw_eq_gain_4
);
785 MAKE_MENU(hw_eq_menu
, ID2P(LANG_EQUALIZER_HARDWARE
), NULL
, Icon_EQ
,
786 &hw_eq_enable
, &hw_eq_band0
, &hw_eq_band1
,
787 &hw_eq_band2
, &hw_eq_band3
, &hw_eq_band4
);