diff options
author | Dan Everton <dan@iocaine.org> | 2008-03-03 11:06:04 +0000 |
---|---|---|
committer | Dan Everton <dan@iocaine.org> | 2008-03-03 11:06:04 +0000 |
commit | 0466319a753555a65fb2173a5c5a8a3bca2fd96f (patch) | |
tree | e390a0fb6cf52b5d6edfc8124353813fe6d914c1 /apps | |
parent | 48a79ade6f375de6b5be8d801f832f36f848106d (diff) | |
download | rockbox-0466319a753555a65fb2173a5c5a8a3bca2fd96f.tar.gz rockbox-0466319a753555a65fb2173a5c5a8a3bca2fd96f.zip |
Try and only use the PCM buffer low latency mode in sound settings when we really need to.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16496 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r-- | apps/SOURCES | 1 | ||||
-rw-r--r-- | apps/menus/eq_menu.c | 4 | ||||
-rw-r--r-- | apps/menus/menu_common.c | 47 | ||||
-rw-r--r-- | apps/menus/menu_common.h | 30 | ||||
-rw-r--r-- | apps/menus/sound_menu.c | 70 |
5 files changed, 117 insertions, 35 deletions
diff --git a/apps/SOURCES b/apps/SOURCES index c93c5bcc1f..e27e15d749 100644 --- a/apps/SOURCES +++ b/apps/SOURCES | |||
@@ -10,6 +10,7 @@ filetypes.c | |||
10 | language.c | 10 | language.c |
11 | main.c | 11 | main.c |
12 | menu.c | 12 | menu.c |
13 | menus/menu_common.c | ||
13 | menus/display_menu.c | 14 | menus/display_menu.c |
14 | menus/theme_menu.c | 15 | menus/theme_menu.c |
15 | #if CONFIG_CODEC == SWCODEC | 16 | #if CONFIG_CODEC == SWCODEC |
diff --git a/apps/menus/eq_menu.c b/apps/menus/eq_menu.c index 1dbb5541c5..2337b32e6d 100644 --- a/apps/menus/eq_menu.c +++ b/apps/menus/eq_menu.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "keyboard.h" | 46 | #include "keyboard.h" |
47 | #include "gui/scrollbar.h" | 47 | #include "gui/scrollbar.h" |
48 | #include "eq_menu.h" | 48 | #include "eq_menu.h" |
49 | #include "menu_common.h" | ||
49 | 50 | ||
50 | /* | 51 | /* |
51 | * Utility functions | 52 | * Utility functions |
@@ -615,8 +616,7 @@ MENUITEM_FUNCTION(eq_save, 0, ID2P(LANG_EQUALIZER_SAVE), | |||
615 | MENUITEM_FUNCTION(eq_browse, 0, ID2P(LANG_EQUALIZER_BROWSE), | 616 | MENUITEM_FUNCTION(eq_browse, 0, ID2P(LANG_EQUALIZER_BROWSE), |
616 | (int(*)(void))eq_browse_presets, NULL, NULL, Icon_NOICON); | 617 | (int(*)(void))eq_browse_presets, NULL, NULL, Icon_NOICON); |
617 | 618 | ||
618 | int soundmenu_callback(int action,const struct menu_item_ex *this_item); | 619 | MAKE_MENU(equalizer_menu, ID2P(LANG_EQUALIZER), lowlatency_callback, Icon_EQ, |
619 | MAKE_MENU(equalizer_menu, ID2P(LANG_EQUALIZER), soundmenu_callback, Icon_EQ, | ||
620 | &eq_enable, &eq_graphical, &eq_precut, &gain_menu, | 620 | &eq_enable, &eq_graphical, &eq_precut, &gain_menu, |
621 | &advanced_eq_menu_, &eq_save, &eq_browse); | 621 | &advanced_eq_menu_, &eq_save, &eq_browse); |
622 | 622 | ||
diff --git a/apps/menus/menu_common.c b/apps/menus/menu_common.c new file mode 100644 index 0000000000..2f3844c1ea --- /dev/null +++ b/apps/menus/menu_common.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 Dan Everton | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <stddef.h> | ||
21 | #include <limits.h> | ||
22 | #include "config.h" | ||
23 | #include "action.h" | ||
24 | #include "menu.h" | ||
25 | #include "menu_common.h" | ||
26 | #if CONFIG_CODEC == SWCODEC | ||
27 | #include "pcmbuf.h" | ||
28 | #endif | ||
29 | |||
30 | #if CONFIG_CODEC == SWCODEC | ||
31 | /* Use this callback if your menu adjusts DSP settings. */ | ||
32 | int lowlatency_callback(int action, const struct menu_item_ex *this_item) | ||
33 | { | ||
34 | (void)this_item; | ||
35 | switch (action) | ||
36 | { | ||
37 | case ACTION_ENTER_MENUITEM: /* on entering an item */ | ||
38 | pcmbuf_set_low_latency(true); | ||
39 | break; | ||
40 | case ACTION_EXIT_MENUITEM: /* on exit */ | ||
41 | pcmbuf_set_low_latency(false); | ||
42 | break; | ||
43 | } | ||
44 | return action; | ||
45 | } | ||
46 | #endif | ||
47 | |||
diff --git a/apps/menus/menu_common.h b/apps/menus/menu_common.h new file mode 100644 index 0000000000..1f835ce72c --- /dev/null +++ b/apps/menus/menu_common.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 Dan Everton | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _MENU_COMMON_H | ||
20 | #define _MENU_COMMON_H | ||
21 | |||
22 | #include "menu.h" | ||
23 | #include "config.h" | ||
24 | |||
25 | #if CONFIG_CODEC == SWCODEC | ||
26 | int lowlatency_callback(int action, const struct menu_item_ex *this_item); | ||
27 | #endif | ||
28 | |||
29 | #endif /* _MENU_COMMON_H */ | ||
30 | |||
diff --git a/apps/menus/sound_menu.c b/apps/menus/sound_menu.c index 127b01d342..315fef81b3 100644 --- a/apps/menus/sound_menu.c +++ b/apps/menus/sound_menu.c | |||
@@ -32,60 +32,64 @@ | |||
32 | #include "pcmbuf.h" | 32 | #include "pcmbuf.h" |
33 | #endif | 33 | #endif |
34 | #include "exported_menus.h" | 34 | #include "exported_menus.h" |
35 | #include "menu_common.h" | ||
35 | 36 | ||
36 | /***********************************/ | 37 | /***********************************/ |
37 | /* SOUND MENU */ | 38 | /* SOUND MENU */ |
38 | #if CONFIG_CODEC == SWCODEC | 39 | MENUITEM_SETTING(volume, &global_settings.volume, NULL); |
39 | /* This callback is also used in the eq menu to toggle low latency mode. | 40 | MENUITEM_SETTING(bass, &global_settings.bass, |
40 | So, remember this if the callback is used for anything other than the togging */ | 41 | #ifdef HAVE_SW_TONE_CONTROLS |
41 | int soundmenu_callback(int action, const struct menu_item_ex *this_item) | 42 | lowlatency_callback |
42 | { | ||
43 | (void)this_item; | ||
44 | switch (action) | ||
45 | { | ||
46 | case ACTION_ENTER_MENUITEM: /* on entering an item */ | ||
47 | pcmbuf_set_low_latency(true); | ||
48 | break; | ||
49 | case ACTION_EXIT_MENUITEM: /* on exit */ | ||
50 | pcmbuf_set_low_latency(false); | ||
51 | break; | ||
52 | } | ||
53 | return action; | ||
54 | } | ||
55 | #else | 43 | #else |
56 | #define soundmenu_callback NULL | 44 | NULL |
57 | #endif | 45 | #endif |
58 | 46 | ); | |
59 | MENUITEM_SETTING(volume, &global_settings.volume, soundmenu_callback); | ||
60 | MENUITEM_SETTING(bass, &global_settings.bass, soundmenu_callback); | ||
61 | #ifdef HAVE_WM8758 | 47 | #ifdef HAVE_WM8758 |
62 | MENUITEM_SETTING(bass_cutoff, &global_settings.bass_cutoff, soundmenu_callback); | 48 | MENUITEM_SETTING(bass_cutoff, &global_settings.bass_cutoff, NULL); |
63 | #endif | 49 | #endif |
64 | MENUITEM_SETTING(treble, &global_settings.treble, soundmenu_callback); | 50 | MENUITEM_SETTING(treble, &global_settings.treble, |
51 | #ifdef HAVE_SW_TONE_CONTROLS | ||
52 | lowlatency_callback | ||
53 | #else | ||
54 | NULL | ||
55 | #endif | ||
56 | ); | ||
65 | #ifdef HAVE_WM8758 | 57 | #ifdef HAVE_WM8758 |
66 | MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, soundmenu_callback); | 58 | MENUITEM_SETTING(treble_cutoff, &global_settings.treble_cutoff, NULL); |
59 | #endif | ||
60 | MENUITEM_SETTING(balance, &global_settings.balance, NULL); | ||
61 | MENUITEM_SETTING(channel_config, &global_settings.channel_config, | ||
62 | #if CONFIG_CODEC == SWCODEC | ||
63 | lowlatency_callback | ||
64 | #else | ||
65 | NULL | ||
66 | #endif | ||
67 | ); | ||
68 | MENUITEM_SETTING(stereo_width, &global_settings.stereo_width, | ||
69 | #if CONFIG_CODEC == SWCODEC | ||
70 | lowlatency_callback | ||
71 | #else | ||
72 | NULL | ||
67 | #endif | 73 | #endif |
68 | MENUITEM_SETTING(balance, &global_settings.balance, soundmenu_callback); | 74 | ); |
69 | MENUITEM_SETTING(channel_config, &global_settings.channel_config, soundmenu_callback); | ||
70 | MENUITEM_SETTING(stereo_width, &global_settings.stereo_width, soundmenu_callback); | ||
71 | 75 | ||
72 | #if CONFIG_CODEC == SWCODEC | 76 | #if CONFIG_CODEC == SWCODEC |
73 | /* Crossfeed Submenu */ | 77 | /* Crossfeed Submenu */ |
74 | MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, soundmenu_callback); | 78 | MENUITEM_SETTING(crossfeed, &global_settings.crossfeed, lowlatency_callback); |
75 | MENUITEM_SETTING(crossfeed_direct_gain, | 79 | MENUITEM_SETTING(crossfeed_direct_gain, |
76 | &global_settings.crossfeed_direct_gain, soundmenu_callback); | 80 | &global_settings.crossfeed_direct_gain, lowlatency_callback); |
77 | MENUITEM_SETTING(crossfeed_cross_gain, | 81 | MENUITEM_SETTING(crossfeed_cross_gain, |
78 | &global_settings.crossfeed_cross_gain, soundmenu_callback); | 82 | &global_settings.crossfeed_cross_gain, lowlatency_callback); |
79 | MENUITEM_SETTING(crossfeed_hf_attenuation, | 83 | MENUITEM_SETTING(crossfeed_hf_attenuation, |
80 | &global_settings.crossfeed_hf_attenuation, soundmenu_callback); | 84 | &global_settings.crossfeed_hf_attenuation, lowlatency_callback); |
81 | MENUITEM_SETTING(crossfeed_hf_cutoff, | 85 | MENUITEM_SETTING(crossfeed_hf_cutoff, |
82 | &global_settings.crossfeed_hf_cutoff, soundmenu_callback); | 86 | &global_settings.crossfeed_hf_cutoff, lowlatency_callback); |
83 | MAKE_MENU(crossfeed_menu,ID2P(LANG_CROSSFEED), NULL, Icon_NOICON, | 87 | MAKE_MENU(crossfeed_menu,ID2P(LANG_CROSSFEED), NULL, Icon_NOICON, |
84 | &crossfeed, &crossfeed_direct_gain, &crossfeed_cross_gain, | 88 | &crossfeed, &crossfeed_direct_gain, &crossfeed_cross_gain, |
85 | &crossfeed_hf_attenuation, &crossfeed_hf_cutoff); | 89 | &crossfeed_hf_attenuation, &crossfeed_hf_cutoff); |
86 | 90 | ||
87 | MENUITEM_SETTING(dithering_enabled, | 91 | MENUITEM_SETTING(dithering_enabled, |
88 | &global_settings.dithering_enabled, soundmenu_callback); | 92 | &global_settings.dithering_enabled, lowlatency_callback); |
89 | #endif | 93 | #endif |
90 | 94 | ||
91 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | 95 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) |