summaryrefslogtreecommitdiffstats
path: root/apps/menus/sound_menu.c
blob: 9d0e615a29bc330543df9b070b013864e93a7357 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128

/***************************************************************************
 *             __________               __   ___.
 *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
 *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
 *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
 *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
 *                     \/            \/     \/    \/            \/
 * $Id:  $
 *
 * Copyright (C) 2007 Jonathan Gordon
 *
 * All files in this archive are subject to the GNU General Public License.
 * See the file COPYING in the source tree root for full license agreement.
 *
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
 * KIND, either express or implied.
 *
 ****************************************************************************/

#include <stdbool.h>
#include <stddef.h>
#include <limits.h>
#include "config.h"
#include "lang.h"
#include "action.h"
#include "settings.h"
#include "menu.h"
#include "sound_menu.h"
#include "eq_menu.h"
#if CONFIG_CODEC == SWCODEC
#include "pcmbuf.h"
#endif

/***********************************/
/*    SOUND MENU                   */
#if CONFIG_CODEC == SWCODEC
int soundmenu_callback(int action,const struct menu_item_ex *this_item)
{
    (void)this_item;
    switch (action)
    {
        case ACTION_ENTER_MENUITEM: /* on entering an item */
            pcmbuf_set_low_latency(true);
            break;
        case ACTION_EXIT_MENUITEM: /* on exit */
            pcmbuf_set_low_latency(false);
            break;
    }
    return action;
}
#else
#define soundmenu_callback NULL
#endif

MENUITEM_SETTING(volume, &global_settings.volume, soundmenu_callback);

#ifndef HAVE_TLV320
    MENUITEM_SETTING(bass, &global_settings.bass, soundmenu_callback);
    MENUITEM_SETTING(treble, &global_settings.treble, soundmenu_callback);
#endif

MENUITEM_SETTING(balance, &global_settings.balance, soundmenu_callback);
MENUITEM_SETTING(channel_config, &global_settings.channel_config, soundmenu_callback);
MENUITEM_SETTING(stereo_width, &global_settings.stereo_width, soundmenu_callback);

#if CONFIG_CODEC == SWCODEC
    /* Crossfeed Submenu */
    MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, soundmenu_callback);
    MENUITEM_SETTING(crossfeed_direct_gain,
                     &global_settings.crossfeed_direct_gain, soundmenu_callback);
    MENUITEM_SETTING(crossfeed_cross_gain,
                     &global_settings.crossfeed_cross_gain, soundmenu_callback);
    MENUITEM_SETTING(crossfeed_hf_attenuation,
                     &global_settings.crossfeed_hf_attenuation, soundmenu_callback);
    MENUITEM_SETTING(crossfeed_hf_cutoff,
                     &global_settings.crossfeed_hf_cutoff, soundmenu_callback);
    MAKE_MENU(crossfeed_menu,ID2P(LANG_CROSSFEED),soundmenu_callback,
              &crossfeed, &crossfeed_direct_gain, &crossfeed_cross_gain,
              &crossfeed_hf_attenuation, &crossfeed_hf_cutoff);
              
    MENUITEM_FUNCTION(equalizer_menu, ID2P(LANG_EQUALIZER),
                      (int(*)(void))eq_menu, NULL);
    MENUITEM_SETTING(dithering_enabled,
                     &global_settings.dithering_enabled, soundmenu_callback);
#ifdef HAVE_WM8758
    MENUITEM_FUNCTION(hw_equalizer_menu, ID2P(LANG_EQUALIZER_HARDWARE),
                      (int(*)(void))eq_hw_menu, NULL);
#endif
#endif

#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
    MENUITEM_SETTING(loudness, &global_settings.loudness, NULL);
    MENUITEM_SETTING(avc, &global_settings.avc, NULL);
    MENUITEM_SETTING(superbass, &global_settings.superbass, NULL);
    MENUITEM_SETTING(mdb_enable, &global_settings.mdb_enable, NULL);
    MENUITEM_SETTING(mdb_strength, &global_settings.mdb_strength, NULL);
    MENUITEM_SETTING(mdb_harmonics, &global_settings.mdb_harmonics, NULL);
    MENUITEM_SETTING(mdb_center, &global_settings.mdb_center, NULL);
    MENUITEM_SETTING(mdb_shape, &global_settings.mdb_shape, NULL);
#endif



MAKE_MENU(sound_settings, ID2P(LANG_SOUND_SETTINGS), NULL,
          &volume,
#ifndef HAVE_TLV320
          &bass,&treble,
#endif
          &balance,&channel_config,&stereo_width
#if CONFIG_CODEC == SWCODEC
         ,&crossfeed_menu, &equalizer_menu,&dithering_enabled
#endif
#ifdef HAVE_WM8758
         ,&hw_equalizer_menu
#endif
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
         ,&loudness,&avc,&superbass,&mdb_enable,&mdb_strength
         ,&mdb_harmonics,&mdb_center,&mdb_shape
#endif
         );
/*    SOUND MENU                   */
/***********************************/

bool sound_menu(void)
{
    return do_menu(&sound_settings);
}