skin tags: fix the id3 track/disc numbers in conditionals
[maemo-rb.git] / apps / menus / sound_menu.c
blobd24a9cd695ce6cbcf8c496fd9afb9648220abad3
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 "sound.h"
27 #include "lang.h"
28 #include "action.h"
29 #include "settings.h"
30 #include "menu.h"
31 #include "sound_menu.h"
32 #include "eq_menu.h"
33 #include "exported_menus.h"
34 #include "menu_common.h"
35 #include "splash.h"
36 #include "kernel.h"
38 /***********************************/
39 /* SOUND MENU */
40 MENUITEM_SETTING(volume, &global_settings.volume, NULL);
41 #ifdef AUDIOHW_HAVE_BASS
42 MENUITEM_SETTING(bass, &global_settings.bass,
43 #ifdef HAVE_SW_TONE_CONTROLS
44 lowlatency_callback
45 #else
46 NULL
47 #endif
50 #ifdef AUDIOHW_HAVE_BASS_CUTOFF
51 MENUITEM_SETTING(bass_cutoff, &global_settings.bass_cutoff, NULL);
52 #endif
53 #endif /* AUDIOHW_HAVE_BASS */
56 #ifdef AUDIOHW_HAVE_TREBLE
57 MENUITEM_SETTING(treble, &global_settings.treble,
58 #ifdef HAVE_SW_TONE_CONTROLS
59 lowlatency_callback
60 #else
61 NULL
62 #endif
65 #ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
66 MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL);
67 #endif
68 #endif /* AUDIOHW_HAVE_TREBLE */
71 MENUITEM_SETTING(balance, &global_settings.balance, NULL);
72 MENUITEM_SETTING(channel_config, &global_settings.channel_config,
73 #if CONFIG_CODEC == SWCODEC
74 lowlatency_callback
75 #else
76 NULL
77 #endif
79 MENUITEM_SETTING(stereo_width, &global_settings.stereo_width,
80 #if CONFIG_CODEC == SWCODEC
81 lowlatency_callback
82 #else
83 NULL
84 #endif
87 #ifdef AUDIOHW_HAVE_DEPTH_3D
88 MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL);
89 #endif
91 #if CONFIG_CODEC == SWCODEC
92 /* Crossfeed Submenu */
93 MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, lowlatency_callback);
94 MENUITEM_SETTING(crossfeed_direct_gain,
95 &global_settings.crossfeed_direct_gain, lowlatency_callback);
96 MENUITEM_SETTING(crossfeed_cross_gain,
97 &global_settings.crossfeed_cross_gain, lowlatency_callback);
98 MENUITEM_SETTING(crossfeed_hf_attenuation,
99 &global_settings.crossfeed_hf_attenuation, lowlatency_callback);
100 MENUITEM_SETTING(crossfeed_hf_cutoff,
101 &global_settings.crossfeed_hf_cutoff, lowlatency_callback);
102 MAKE_MENU(crossfeed_menu,ID2P(LANG_CROSSFEED), NULL, Icon_NOICON,
103 &crossfeed, &crossfeed_direct_gain, &crossfeed_cross_gain,
104 &crossfeed_hf_attenuation, &crossfeed_hf_cutoff);
106 #ifdef HAVE_PITCHCONTROL
107 static int timestretch_callback(int action,const struct menu_item_ex *this_item)
109 switch (action)
111 case ACTION_EXIT_MENUITEM: /* on exit */
112 if (global_settings.timestretch_enabled && !dsp_timestretch_available())
113 splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
114 break;
116 lowlatency_callback(action, this_item);
117 return action;
119 MENUITEM_SETTING(timestretch_enabled,
120 &global_settings.timestretch_enabled, timestretch_callback);
121 #endif
123 MENUITEM_SETTING(dithering_enabled,
124 &global_settings.dithering_enabled, lowlatency_callback);
126 /* compressor submenu */
127 MENUITEM_SETTING(compressor_threshold,
128 &global_settings.compressor_settings.threshold,
129 lowlatency_callback);
130 MENUITEM_SETTING(compressor_gain,
131 &global_settings.compressor_settings.makeup_gain,
132 lowlatency_callback);
133 MENUITEM_SETTING(compressor_ratio,
134 &global_settings.compressor_settings.ratio,
135 lowlatency_callback);
136 MENUITEM_SETTING(compressor_knee,
137 &global_settings.compressor_settings.knee,
138 lowlatency_callback);
139 MENUITEM_SETTING(compressor_release,
140 &global_settings.compressor_settings.release_time,
141 lowlatency_callback);
142 MAKE_MENU(compressor_menu,ID2P(LANG_COMPRESSOR), NULL, Icon_NOICON,
143 &compressor_threshold, &compressor_gain, &compressor_ratio,
144 &compressor_knee, &compressor_release);
145 #endif
147 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
148 MENUITEM_SETTING(loudness, &global_settings.loudness, NULL);
149 MENUITEM_SETTING(avc, &global_settings.avc, NULL);
150 MENUITEM_SETTING(superbass, &global_settings.superbass, NULL);
151 MENUITEM_SETTING(mdb_enable, &global_settings.mdb_enable, NULL);
152 MENUITEM_SETTING(mdb_strength, &global_settings.mdb_strength, NULL);
153 MENUITEM_SETTING(mdb_harmonics, &global_settings.mdb_harmonics, NULL);
154 MENUITEM_SETTING(mdb_center, &global_settings.mdb_center, NULL);
155 MENUITEM_SETTING(mdb_shape, &global_settings.mdb_shape, NULL);
156 #endif
158 #ifdef HAVE_SPEAKER
159 MENUITEM_SETTING(speaker_enabled, &global_settings.speaker_enabled, NULL);
160 #endif
162 #ifdef AUDIOHW_HAVE_EQ
163 #endif /* AUDIOHW_HAVE_EQ */
165 MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
166 &volume
167 #ifdef AUDIOHW_HAVE_BASS
168 ,&bass
169 #endif
170 #ifdef AUDIOHW_HAVE_BASS_CUTOFF
171 ,&bass_cutoff
172 #endif
173 #ifdef AUDIOHW_HAVE_TREBLE
174 ,&treble
175 #endif
176 #ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
177 ,&treble_cutoff
178 #endif
179 #ifdef AUDIOHW_HAVE_EQ
180 ,&audiohw_eq_tone_controls
181 #endif
182 ,&balance,&channel_config,&stereo_width
183 #ifdef AUDIOHW_HAVE_DEPTH_3D
184 ,&depth_3d
185 #endif
186 #if CONFIG_CODEC == SWCODEC
187 ,&crossfeed_menu, &equalizer_menu, &dithering_enabled
188 #ifdef HAVE_PITCHCONTROL
189 ,&timestretch_enabled
190 #endif
191 ,&compressor_menu
192 #endif
193 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
194 ,&loudness,&avc,&superbass,&mdb_enable,&mdb_strength
195 ,&mdb_harmonics,&mdb_center,&mdb_shape
196 #endif
197 #ifdef HAVE_SPEAKER
198 ,&speaker_enabled
199 #endif