Remove useless operation.
[maemo-rb.git] / apps / menus / sound_menu.c
blob0817304f8d6bbeb21d8f40b1c86490a599aeea5a
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"
37 #include "dsp.h"
39 /***********************************/
40 /* SOUND MENU */
41 MENUITEM_SETTING(volume, &global_settings.volume, NULL);
42 #ifdef AUDIOHW_HAVE_BASS
43 MENUITEM_SETTING(bass, &global_settings.bass,
44 #ifdef HAVE_SW_TONE_CONTROLS
45 lowlatency_callback
46 #else
47 NULL
48 #endif
51 #ifdef AUDIOHW_HAVE_BASS_CUTOFF
52 MENUITEM_SETTING(bass_cutoff, &global_settings.bass_cutoff, NULL);
53 #endif
54 #endif /* AUDIOHW_HAVE_BASS */
57 #ifdef AUDIOHW_HAVE_TREBLE
58 MENUITEM_SETTING(treble, &global_settings.treble,
59 #ifdef HAVE_SW_TONE_CONTROLS
60 lowlatency_callback
61 #else
62 NULL
63 #endif
66 #ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
67 MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL);
68 #endif
69 #endif /* AUDIOHW_HAVE_TREBLE */
72 MENUITEM_SETTING(balance, &global_settings.balance, NULL);
73 MENUITEM_SETTING(channel_config, &global_settings.channel_config,
74 #if CONFIG_CODEC == SWCODEC
75 lowlatency_callback
76 #else
77 NULL
78 #endif
80 MENUITEM_SETTING(stereo_width, &global_settings.stereo_width,
81 #if CONFIG_CODEC == SWCODEC
82 lowlatency_callback
83 #else
84 NULL
85 #endif
88 #ifdef AUDIOHW_HAVE_DEPTH_3D
89 MENUITEM_SETTING(depth_3d, &global_settings.depth_3d, NULL);
90 #endif
92 #if CONFIG_CODEC == SWCODEC
93 /* Crossfeed Submenu */
94 MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, lowlatency_callback);
95 MENUITEM_SETTING(crossfeed_direct_gain,
96 &global_settings.crossfeed_direct_gain, lowlatency_callback);
97 MENUITEM_SETTING(crossfeed_cross_gain,
98 &global_settings.crossfeed_cross_gain, lowlatency_callback);
99 MENUITEM_SETTING(crossfeed_hf_attenuation,
100 &global_settings.crossfeed_hf_attenuation, lowlatency_callback);
101 MENUITEM_SETTING(crossfeed_hf_cutoff,
102 &global_settings.crossfeed_hf_cutoff, lowlatency_callback);
103 MAKE_MENU(crossfeed_menu,ID2P(LANG_CROSSFEED), NULL, Icon_NOICON,
104 &crossfeed, &crossfeed_direct_gain, &crossfeed_cross_gain,
105 &crossfeed_hf_attenuation, &crossfeed_hf_cutoff);
107 #ifdef HAVE_PITCHSCREEN
108 static int timestretch_callback(int action,const struct menu_item_ex *this_item)
110 switch (action)
112 case ACTION_EXIT_MENUITEM: /* on exit */
113 if (global_settings.timestretch_enabled && !dsp_timestretch_available())
114 splash(HZ*2, ID2P(LANG_PLEASE_REBOOT));
115 break;
117 lowlatency_callback(action, this_item);
118 return action;
120 MENUITEM_SETTING(timestretch_enabled,
121 &global_settings.timestretch_enabled, timestretch_callback);
122 #endif
124 MENUITEM_SETTING(dithering_enabled,
125 &global_settings.dithering_enabled, lowlatency_callback);
127 /* compressor submenu */
128 MENUITEM_SETTING(compressor_threshold,
129 &global_settings.compressor_settings.threshold,
130 lowlatency_callback);
131 MENUITEM_SETTING(compressor_gain,
132 &global_settings.compressor_settings.makeup_gain,
133 lowlatency_callback);
134 MENUITEM_SETTING(compressor_ratio,
135 &global_settings.compressor_settings.ratio,
136 lowlatency_callback);
137 MENUITEM_SETTING(compressor_knee,
138 &global_settings.compressor_settings.knee,
139 lowlatency_callback);
140 MENUITEM_SETTING(compressor_release,
141 &global_settings.compressor_settings.release_time,
142 lowlatency_callback);
143 MAKE_MENU(compressor_menu,ID2P(LANG_COMPRESSOR), NULL, Icon_NOICON,
144 &compressor_threshold, &compressor_gain, &compressor_ratio,
145 &compressor_knee, &compressor_release);
146 #endif
148 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
149 MENUITEM_SETTING(loudness, &global_settings.loudness, NULL);
150 MENUITEM_SETTING(avc, &global_settings.avc, NULL);
151 MENUITEM_SETTING(superbass, &global_settings.superbass, NULL);
152 MENUITEM_SETTING(mdb_enable, &global_settings.mdb_enable, NULL);
153 MENUITEM_SETTING(mdb_strength, &global_settings.mdb_strength, NULL);
154 MENUITEM_SETTING(mdb_harmonics, &global_settings.mdb_harmonics, NULL);
155 MENUITEM_SETTING(mdb_center, &global_settings.mdb_center, NULL);
156 MENUITEM_SETTING(mdb_shape, &global_settings.mdb_shape, NULL);
157 #endif
159 #ifdef HAVE_SPEAKER
160 MENUITEM_SETTING(speaker_enabled, &global_settings.speaker_enabled, NULL);
161 #endif
163 #ifdef AUDIOHW_HAVE_EQ
164 #endif /* AUDIOHW_HAVE_EQ */
166 MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL, Icon_Audio,
167 &volume
168 #ifdef AUDIOHW_HAVE_BASS
169 ,&bass
170 #endif
171 #ifdef AUDIOHW_HAVE_BASS_CUTOFF
172 ,&bass_cutoff
173 #endif
174 #ifdef AUDIOHW_HAVE_TREBLE
175 ,&treble
176 #endif
177 #ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
178 ,&treble_cutoff
179 #endif
180 #ifdef AUDIOHW_HAVE_EQ
181 ,&audiohw_eq_tone_controls
182 #endif
183 ,&balance,&channel_config,&stereo_width
184 #ifdef AUDIOHW_HAVE_DEPTH_3D
185 ,&depth_3d
186 #endif
187 #if CONFIG_CODEC == SWCODEC
188 ,&crossfeed_menu, &equalizer_menu, &dithering_enabled
189 #ifdef HAVE_PITCHSCREEN
190 ,&timestretch_enabled
191 #endif
192 ,&compressor_menu
193 #endif
194 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
195 ,&loudness,&avc,&superbass,&mdb_enable,&mdb_strength
196 ,&mdb_harmonics,&mdb_center,&mdb_shape
197 #endif
198 #ifdef HAVE_SPEAKER
199 ,&speaker_enabled
200 #endif