Index: apps/pcmbuf.c
===================================================================
--- apps/pcmbuf.c (revision 15628)
+++ apps/pcmbuf.c (working copy)
@@ -998,7 +998,11 @@
if (buf > pcmbuf_end)
buf = (short *)audiobuffer;
}
- pcm_play_data(NULL, (unsigned char *)audiobuffer, samples * 4);
+
+ /* pcm_play_data of 0 samples should work fine, so the following
+ test should not be needed, but fixes nasty noises on PP targets */
+ if (samples != 0)
+ pcm_play_data(NULL, (unsigned char *)audiobuffer, samples * 4);
}
}
Index: apps/action.c
===================================================================
--- apps/action.c (revision 15628)
+++ apps/action.c (working copy)
@@ -8,7 +8,7 @@
* $Id$
*
* Copyright (C) 2006 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.
*
@@ -28,8 +28,10 @@
#include "kernel.h"
#include "debug.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 */
static intptr_t last_data = 0;
static int last_action = ACTION_NONE;
@@ -63,7 +65,7 @@
while (items[i].button_code != BUTTON_NONE)
{
- if (items[i].button_code == button)
+ if (items[i].button_code == button)
{
if ((items[i].pre_button_code == BUTTON_NONE)
|| (items[i].pre_button_code == last_button))
@@ -82,8 +84,8 @@
{
while (items[i].button_code != BUTTON_NONE)
i++;
- return (items[i].action_code == ACTION_NONE ) ?
- CONTEXT_STD :
+ return (items[i].action_code == ACTION_NONE ) ?
+ CONTEXT_STD :
items[i].action_code;
}
/*
@@ -96,11 +98,11 @@
the last item in the list "points" to the next context in a chain
so the "chain" is followed until the button is found.
putting ACTION_NONE will get CONTEXT_STD which is always the last list checked.
-
+
Timeout can be TIMEOUT_NOBLOCK to return immediatly
TIMEOUT_BLOCK to wait for a button press
-Any number >0 to wait that many ticks for a press
-
+ Any number >0 to wait that many ticks for a press
+
*/
static int get_action_worker(int context, int timeout,
const struct button_mapping* (*get_context_map)(int) )
@@ -110,7 +112,7 @@
int i=0;
int ret = ACTION_UNKNOWN;
static int last_context = CONTEXT_STD;
-
+
if (timeout == TIMEOUT_NOBLOCK)
button = button_get(false);
else if (timeout == TIMEOUT_BLOCK)
@@ -119,14 +121,19 @@
button = button_get_w_tmo(timeout);
/* 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;
- }
-
- if ((context != last_context) && ((last_button&BUTTON_REL) == 0))
+
+#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))
{
- if (button&BUTTON_REL)
+ if (button & BUTTON_REL)
{
last_button = button;
last_action = ACTION_NONE;
@@ -137,18 +144,15 @@
}
last_context = context;
#ifdef HAVE_TOUCHPAD
- if (button&BUTTON_TOUCHPAD)
+ if (button & BUTTON_TOUCHPAD)
{
repeated = false;
short_press = false;
- if (last_button&BUTTON_TOUCHPAD)
+ if (last_button & BUTTON_TOUCHPAD)
{
- if ((button&BUTTON_REL) &&
- ((last_button&BUTTON_REPEAT)==0))
- {
+ if ((button & BUTTON_REL) && !(last_button & BUTTON_REPEAT))
short_press = true;
- }
- else if (button&BUTTON_REPEAT)
+ else if (button & BUTTON_REPEAT)
repeated = true;
}
last_button = button;
@@ -156,48 +160,48 @@
}
#endif
#ifndef HAS_BUTTON_HOLD
- screen_has_lock = ((context&ALLOW_SOFTLOCK)==ALLOW_SOFTLOCK);
+ screen_has_lock = ((context & ALLOW_SOFTLOCK) == ALLOW_SOFTLOCK);
if (screen_has_lock && (keys_locked == true))
{
- if (button == unlock_combo)
+ if (button == unlock_combo)
{
last_button = BUTTON_NONE;
keys_locked = false;
gui_syncsplash(HZ/2, str(LANG_KEYLOCK_OFF));
return ACTION_REDRAW;
- }
- else
-#if (BUTTON_REMOTE != 0)
- if ((button&BUTTON_REMOTE) == 0)
+ }
+ else
+#if (BUTTON_REMOTE != 0)
+ if (!(button & BUTTON_REMOTE))
#endif
{
- if ((button&BUTTON_REL))
+ if ((button & BUTTON_REL))
gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON));
return ACTION_REDRAW;
}
}
context &= ~ALLOW_SOFTLOCK;
#endif /* HAS_BUTTON_HOLD */
-
+
/* logf("%x,%x",last_button,button); */
- do
+ do
{
/* logf("context = %x",context); */
#if (BUTTON_REMOTE != 0)
- if (button&BUTTON_REMOTE)
+ if (button & BUTTON_REMOTE)
context |= CONTEXT_REMOTE;
#endif
- if ((context&CONTEXT_CUSTOM) && get_context_map)
+ if ((context & CONTEXT_CUSTOM) && get_context_map)
items = get_context_map(context);
else
items = get_context_mapping(context);
-
+
ret = do_button_check(items,button,last_button,&i);
-
+
if ((context ==(int)CONTEXT_STOPSEARCHING) ||
items == NULL )
break;
-
+
if (ret == ACTION_UNKNOWN )
{
context = get_next_context(items,i);
@@ -208,19 +212,19 @@
/* DEBUGF("ret = %x\n",ret); */
#ifndef HAS_BUTTON_HOLD
if (screen_has_lock && (ret == ACTION_STD_KEYLOCK))
- {
+ {
unlock_combo = button;
keys_locked = true;
gui_syncsplash(HZ/2, str(LANG_KEYLOCK_ON));
-
+
button_clear_queue();
return ACTION_REDRAW;
}
#endif
- if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS)
+ if ((current_tick - last_action_tick < REPEAT_WINDOW_TICKS)
&& (ret == last_action))
repeated = true;
- else
+ else
repeated = false;
last_button = button;
@@ -266,7 +270,7 @@
if (button)
*button = last_button;
- if (last_button&BUTTON_REMOTE)
+ if (last_button & BUTTON_REMOTE)
ret |= ACTION_REMOTE;
if (repeated)
ret |= ACTION_REPEAT;
@@ -283,10 +287,10 @@
{
static int last_data = 0;
int data;
- if ((last_button&BUTTON_TOUCHPAD) == 0)
+ if (!(last_button & BUTTON_TOUCHPAD))
return BUTTON_NONE;
data = button_get_data();
- if (last_button&BUTTON_REL)
+ if (last_button & BUTTON_REL)
{
*x = (last_data&0xffff0000)>>16;
*y = (last_data&0xffff);
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang (revision 15628)
+++ apps/lang/english.lang (working copy)
@@ -11478,3 +11478,37 @@
*: "Say file type"
+
+ id: LANG_KEYCLICK
+ desc: in keyclick settings menu
+ user:
+
+ *: none
+ swcodec: "Keyclick"
+
+
+ *: none
+ swcodec: "Keyclick"
+
+
+ *: none
+ swcodec: "Keyclick"
+
+
+
+ id: LANG_KEYCLICK_REPEATS
+ desc: in keyclick settings menu
+ user:
+
+ *: none
+ swcodec: "Keyclick Repeats"
+
+
+ *: none
+ swcodec: "Keyclick Repeats"
+
+
+ *: none
+ swcodec: "Keyclick Repeats"
+
+
Index: apps/settings.h
===================================================================
--- apps/settings.h (revision 15628)
+++ apps/settings.h (working copy)
@@ -268,12 +268,12 @@
const struct opt_items* options, int numoptions, void (*function)(int));
bool set_int(const unsigned char* string, const char* unit, int voice_unit,
int* variable,
- void (*function)(int), int step, int min, int max,
+ void (*function)(int), int step, int min, int max,
void (*formatter)(char*, size_t, int, const char*) );
/* use this one if you need to create a lang from the value (i.e with TALK_ID()) */
bool set_int_ex(const unsigned char* string, const char* unit, int voice_unit,
int* variable,
- void (*function)(int), int step, int min, int max,
+ void (*function)(int), int step, int min, int max,
void (*formatter)(char*, size_t, int, const char*),
long (*get_talk_id)(int));
@@ -371,7 +371,7 @@
1 = main lcd
2 = main and remote lcd
3 = remote lcd */
-
+
int rec_start_thres; /* negative: db, positive: % range -87 .. 100 */
int rec_start_duration; /* index of trig_durations */
int rec_stop_thres; /* negative: db, positive: % */
@@ -527,7 +527,7 @@
bool talk_menu; /* enable voice UI */
int talk_dir; /* voiced directories mode: 0=off 1=number 2=spell */
bool talk_dir_clip; /* use directory .talk clips */
- int talk_file; /* voice file mode: 0=off, 1=number, 2=spell */
+ int talk_file; /* voice file mode: 0=off, 1=number, 2=spell */
bool talk_file_clip; /* use file .talk clips */
bool talk_filetype; /* say file type */
bool talk_battery_level;
@@ -535,7 +535,7 @@
/* file browser sorting */
int sort_file; /* 0=alpha, 1=date, 2=date (new first), 3=type */
int sort_dir; /* 0=alpha, 1=date (old first), 2=date (new first) */
-
+
#ifdef HAVE_REMOTE_LCD
/* remote lcd */
int remote_contrast; /* lcd contrast: 0-63 0=low 63=high */
@@ -555,7 +555,7 @@
1=EMI reduce on with cost more CPU. */
#endif
#endif /* HAVE_REMOTE_LCD */
-
+
int next_folder; /* move to next folder */
bool runtimedb; /* runtime database active? */
@@ -566,7 +566,7 @@
shuffle is on, album gain otherwise */
int replaygain_preamp; /* scale replaygained tracks by this */
int beep; /* system beep volume when changing tracks etc. */
-
+
/* Crossfeed settings */
bool crossfeed; /* enable crossfeed */
unsigned int crossfeed_direct_gain; /* - dB x 10 */
@@ -587,7 +587,7 @@
#ifdef HAVE_REMOTE_LCD
unsigned char rwps_file[MAX_FILENAME+1]; /* last remote-wps */
#endif
-#ifdef HAVE_BACKLIGHT_BRIGHTNESS
+#ifdef HAVE_BACKLIGHT_BRIGHTNESS
int brightness; /* iriver h300: backlight PWM value: 2..15
(0 and 1 are black) */
#endif
@@ -641,7 +641,7 @@
int lst_color; /* color of the text for the selector */
#endif
bool party_mode; /* party mode - unstoppable music */
-
+
#ifdef HAVE_BACKLIGHT
bool bl_filter_first_keypress; /* filter first keypress when dark? */
#ifdef HAVE_REMOTE_LCD
@@ -669,9 +669,9 @@
#ifdef HAVE_WM8758
bool eq_hw_enabled; /* Enable hardware equalizer */
-
+
int eq_hw_band0_cutoff;
- int eq_hw_band0_gain;
+ int eq_hw_band0_gain;
int eq_hw_band1_center;
int eq_hw_band1_bandwidth;
@@ -748,6 +748,10 @@
int usb_stack_mode; /* device or host */
unsigned char usb_stack_device_driver[32]; /* usb device driver to load */
#endif
+#if CONFIG_CODEC == SWCODEC
+ int keyclick; /* keyclick volume */
+ int keyclick_repeats; /* keyclick on repeats */
+#endif
};
/** global variables **/
Index: apps/menus/settings_menu.c
===================================================================
--- apps/menus/settings_menu.c (revision 15628)
+++ apps/menus/settings_menu.c (working copy)
@@ -313,6 +313,16 @@
MENUITEM_SETTING(max_files_in_playlist, &global_settings.max_files_in_playlist, NULL);
MAKE_MENU(limits_menu, ID2P(LANG_LIMITS_MENU), 0, Icon_NOICON,
&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
void dac_line_in(bool enable);
@@ -342,7 +352,8 @@
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
MENUITEM_SETTING(buttonlight_brightness, &global_settings.buttonlight_brightness, NULL);
-#endif
+#endif
+
MAKE_MENU(system_menu, ID2P(LANG_SYSTEM),
0, Icon_System_menu,
@@ -374,7 +385,10 @@
&buttonlight_timeout,
#endif
#ifdef HAVE_BUTTONLIGHT_BRIGHTNESS
- &buttonlight_brightness
+ &buttonlight_brightness,
+#endif
+#if CONFIG_CODEC == SWCODEC
+ &keyclick_menu,
#endif
);
Index: apps/settings_list.c
===================================================================
--- apps/settings_list.c (revision 15628)
+++ apps/settings_list.c (working copy)
@@ -1277,7 +1277,15 @@
2, ID2P(LANG_USBSTACK_DEVICE), ID2P(LANG_USBSTACK_HOST)),
FILENAME_SETTING(0, usb_stack_device_driver, "usb device driver",
"storage", NULL, NULL, 32),
-#endif /* HAVE_USBSTACK */
+#endif /* HAVE_USBSTACK */
+
+#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
};
const int nb_settings = sizeof(settings)/sizeof(*settings);