1
0
Fork 0
forked from len0rd/rockbox

Keyclick option (FS#7307). Disabled by default, go into System settings to enable it. WARNING: PortalPlayer targets reportedly have a problem with this, so don't enable it on those unless you want to risk burning your ears with horrible noise. This is probably a bug in pcmbuf_beep(), and I'm hoping that someone who has an affected target will look into it and fix it as a result of this commit.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16132 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2008-01-21 09:48:44 +00:00
parent cba886d9b7
commit ea358a1fdc
5 changed files with 116 additions and 50 deletions

View file

@ -28,6 +28,8 @@
#include "kernel.h" #include "kernel.h"
#include "debug.h" #include "debug.h"
#include "splash.h" #include "splash.h"
#include "settings.h"
#include "pcmbuf.h"
static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to static int last_button = BUTTON_NONE|BUTTON_REL; /* allow the ipod wheel to
work on startup */ work on startup */
@ -120,9 +122,14 @@ static int get_action_worker(int context, int timeout,
/* Data from sys events can be pulled with button_get_data */ /* Data from sys events can be pulled with button_get_data */
if (button == BUTTON_NONE || button & SYS_EVENT) if (button == BUTTON_NONE || button & SYS_EVENT)
{
return button; return button;
}
#if CONFIG_CODEC == SWCODEC
/* Produce keyclick */
if (global_settings.keyclick && !(button & BUTTON_REL))
if (!(button & BUTTON_REPEAT) || global_settings.keyclick_repeats)
pcmbuf_beep(5000, 2, 2500*global_settings.keyclick);
#endif
if ((context != last_context) && ((last_button & BUTTON_REL) == 0)) if ((context != last_context) && ((last_button & BUTTON_REL) == 0))
{ {

View file

@ -11540,3 +11540,37 @@
*: "Save Sound Settings" *: "Save Sound Settings"
</voice> </voice>
</phrase> </phrase>
<phrase>
id: LANG_KEYCLICK
desc: in keyclick settings men
user:
<source>
*: none
swcodec: "Keyclick"
</source>
<dest>
*: none
swcodec: "Keyclick"
</dest>
<voice>
*: none
swcodec: "Keyclick"
</voice>
</phrase>
<phrase>
id: LANG_KEYCLICK_REPEATS
desc: in keyclick settings men
user:
<source>
*: none
swcodec: "Keyclick Repeats"
</source>
<dest>
*: none
swcodec: "Keyclick Repeats"
</dest>
<voice>
*: none
swcodec: "Keyclick Repeats"
</voice>
</phrase>

View file

@ -312,6 +312,16 @@ MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist,
MAKE_MENU(limits_menu, ID2P(LANG_LIMITS_MENU), 0, Icon_NOICON, MAKE_MENU(limits_menu, ID2P(LANG_LIMITS_MENU), 0, Icon_NOICON,
&max_files_in_dir, &max_files_in_playlist); &max_files_in_dir, &max_files_in_playlist);
/* Keyclick menu */
#if CONFIG_CODEC == SWCODEC
MENUITEM_SETTING(keyclick, &global_settings.keyclick, NULL);
MENUITEM_SETTING(keyclick_repeats, &global_settings.keyclick_repeats, NULL);
MAKE_MENU(keyclick_menu, ID2P(LANG_KEYCLICK), 0, Icon_NOICON,
&keyclick, &keyclick_repeats);
#endif
#if CONFIG_CODEC == MAS3507D #if CONFIG_CODEC == MAS3507D
void dac_line_in(bool enable); void dac_line_in(bool enable);
static int linein_callback(int action,const struct menu_item_ex *this_item) static int linein_callback(int action,const struct menu_item_ex *this_item)
@ -342,6 +352,7 @@ MENUITEM_SETTING(buttonlight_timeout, &global_settings.buttonlight_timeout, NULL
MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL); MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL);
#endif #endif
MAKE_MENU(system_menu, ID2P(LANG_SYSTEM), MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
0, Icon_System_menu, 0, Icon_System_menu,
&start_screen, &start_screen,
@ -372,7 +383,10 @@ MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
&buttonlight_timeout, &buttonlight_timeout,
#endif #endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS #ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
&buttonlight_brightness &buttonlight_brightness,
#endif
#if CONFIG_CODEC == SWCODEC
&keyclick_menu,
#endif #endif
); );

View file

@ -719,6 +719,10 @@ struct user_settings
int usb_stack_mode; /* device or host */ int usb_stack_mode; /* device or host */
unsigned char usb_stack_device_driver[32]; /* usb device driver to load */ unsigned char usb_stack_device_driver[32]; /* usb device driver to load */
#endif #endif
#if CONFIG_CODEC == SWCODEC
int keyclick; /* keyclick volume */
int keyclick_repeats; /* keyclick on repeats */
#endif
}; };
/** global variables **/ /** global variables **/

View file

@ -1180,6 +1180,13 @@ const struct settings_list settings[] = {
#if CONFIG_TUNER #if CONFIG_TUNER
SYSTEM_SETTING(0, statusbar_forced, 0), SYSTEM_SETTING(0, statusbar_forced, 0),
#endif #endif
#if CONFIG_CODEC == SWCODEC
/* keyclick */
CHOICE_SETTING(0, keyclick, LANG_KEYCLICK, 0,
"keyclick", "off,weak,moderate,strong", NULL, 4,
ID2P(LANG_OFF), ID2P(LANG_WEAK), ID2P(LANG_MODERATE), ID2P(LANG_STRONG)),
OFFON_SETTING(0, keyclick_repeats, LANG_KEYCLICK_REPEATS, false, "keyclick repeats", NULL),
#endif /* CONFIG_CODEC == SWCODEC */
}; };
const int nb_settings = sizeof(settings)/sizeof(*settings); const int nb_settings = sizeof(settings)/sizeof(*settings);