FS#10199: Adds limiter DSP function
[kugel-rb.git] / apps / menus / sound_menu.c
blob678d495d07fbdda3c3d64bdaff5a5df8b0dc8853
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Jonathan Gordon
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include <stdbool.h>
23 #include <stddef.h>
24 #include <limits.h>
25 #include "config.h"
26 #include "lang.h"
27 #include "action.h"
28 #include "settings.h"
29 #include "menu.h"
30 #include "sound_menu.h"
31 #include "eq_menu.h"
32 #include "exported_menus.h"
33 #include "menu_common.h"
34 #include "splash.h"
35 #include "kernel.h"
36 #include "dsp.h"
38 /***********************************/
39 /* SOUND MENU */
40 MENUITEM_SETTING(volume, &global_settings.volume, NULL);
41 MENUITEM_SETTING(bass, &global_settings.bass,
42 #ifdef HAVE_SW_TONE_CONTROLS
43 lowlatency_callback
44 #else
45 NULL
46 #endif
48 #ifdef HAVE_WM8758
49 MENUITEM_SETTING(bass_cutoff, &global_settings.bass_cutoff, NULL);
50 #endif
51 MENUITEM_SETTING(treble, &global_settings.treble,
52 #ifdef HAVE_SW_TONE_CONTROLS
53 lowlatency_callback
54 #else
55 NULL
56 #endif
58 #ifdef HAVE_WM8758
59 MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL);
60 #endif
61 MENUITEM_SETTING(balance, &global_settings.balance, NULL);
62 MENUITEM_SETTING(channel_config, &global_settings.channel_config,
63 #if CONFIG_CODEC == SWCODEC
64 lowlatency_callback
65 #else
66 NULL
67 #endif
69 MENUITEM_SETTING(stereo_width, &global_settings.stereo_width,
70 #if CONFIG_CODEC == SWCODEC
71 lowlatency_callback
72 #else
73 NULL
74 #endif
77 #if CONFIG_CODEC == SWCODEC
78 /* Crossfeed Submenu */
79 MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, lowlatency_callback);
80 MENUITEM_SETTING(crossfeed_direct_gain,
81 &global_settings.crossfeed_direct_gain, lowlatency_callback);
82 MENUITEM_SETTING(crossfeed_cross_gain,
83 &global_settings.crossfeed_cross_gain, lowlatency_callback);
84 MENUITEM_SETTING(crossfeed_hf_attenuation,
85 &global_settings.crossfeed_hf_attenuation, lowlatency_callback);
86 MENUITEM_SETTING(crossfeed_hf_cutoff,
87 &global_settings.crossfeed_hf_cutoff, lowlatency_callback);
88 MAKE_MENU(crossfeed_menu,ID2P(LANG_CROSSFEED), NULL, Icon_NOICON,
89 &crossfeed, &crossfeed_direct_gain, &crossfeed_cross_gain,
90 &crossfeed_hf_attenuation, &crossfeed_hf_cutoff);
92 static int timestretch_callback(int action,const struct menu_item_ex *this_item)
94 switch (action)
96 case ACTION_EXIT_MENUITEM: /* on exit */
97 if (global_settings.timestretch_enabled && !dsp_timestretch_available())
98 splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
99 break;
101 lowlatency_callback(action, this_item);
102 return action;
104 MENUITEM_SETTING(timestretch_enabled,
105 &global_settings.timestretch_enabled, timestretch_callback);
106 MENUITEM_SETTING(dithering_enabled,
107 &global_settings.dithering_enabled, lowlatency_callback);
108 MENUITEM_SETTING(limiter_level,
109 &global_settings.limiter_level, lowlatency_callback);
110 #endif
112 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
113 MENUITEM_SETTING(loudness, &global_settings.loudness, NULL);
114 MENUITEM_SETTING(avc, &global_settings.avc, NULL);
115 MENUITEM_SETTING(superbass, &global_settings.superbass, NULL);
116 MENUITEM_SETTING(mdb_enable, &global_settings.mdb_enable, NULL);
117 MENUITEM_SETTING(mdb_strength, &global_settings.mdb_strength, NULL);
118 MENUITEM_SETTING(mdb_harmonics, &global_settings.mdb_harmonics, NULL);
119 MENUITEM_SETTING(mdb_center, &global_settings.mdb_center, NULL);
120 MENUITEM_SETTING(mdb_shape, &global_settings.mdb_shape, NULL);
121 #endif
123 #ifdef HAVE_SPEAKER
124 MENUITEM_SETTING(speaker_enabled, &global_settings.speaker_enabled, NULL);
125 #endif
129 MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
130 &volume,
131 &bass,
132 #ifdef HAVE_WM8758
133 &bass_cutoff,
134 #endif
135 &treble,
136 #ifdef HAVE_WM8758
137 &treble_cutoff,
138 #endif
139 &balance,&channel_config,&stereo_width
140 #if CONFIG_CODEC == SWCODEC
141 ,&crossfeed_menu, &equalizer_menu, &dithering_enabled
142 ,&timestretch_enabled
143 ,&limiter_level
144 #endif
145 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
146 ,&loudness,&avc,&superbass,&mdb_enable,&mdb_strength
147 ,&mdb_harmonics,&mdb_center,&mdb_shape
148 #endif
149 #ifdef HAVE_SPEAKER
150 ,&speaker_enabled
151 #endif