First step of the voice-UI: the menus can talk. You need a "voicefont" file in .rockbox to use this.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4381 a1c6a512-1295-4272-9138-f99709370657
diff --git a/apps/menu.c b/apps/menu.c
index f187b5d..f944354 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -32,6 +32,7 @@
#include "settings.h"
#include "status.h"
#include "screens.h"
+#include "talk.h"
#ifdef HAVE_LCD_BITMAP
#include "icons.h"
@@ -216,6 +217,13 @@
lcd_update();
}
+ if (do_update)
+ { /* "say" the entry under the cursor */
+ int voice_id = menus[m].items[menus[m].cursor].voice_id;
+ if (voice_id >= 0) /* valid ID given? */
+ talk_id(voice_id, false); /* say it */
+ }
+
}
int menu_init(struct menu_items* mitems, int count, int (*callback)(int, int))
@@ -250,6 +258,7 @@
{
bool exit = false;
int key;
+ int voice_id;
#ifdef HAVE_LCD_BITMAP
int fw, fh;
int menu_lines;
@@ -263,9 +272,16 @@
menu_draw(m);
+ /* say current entry */
+ voice_id = menus[m].items[menus[m].cursor].voice_id;
+ if (voice_id >= 0) /* valid ID given? */
+ talk_id(voice_id, false); /* say it */
+
while (!exit) {
key = button_get_w_tmo(HZ/2);
+
+
/*
* "short-circuit" the default keypresses by running the callback function
*/
@@ -274,6 +290,7 @@
key = menus[m].callback(key, m); /* make sure there's no match in the switch */
switch( key ) {
+
#ifdef HAVE_RECORDER_KEYPAD
case BUTTON_UP:
case BUTTON_UP | BUTTON_REPEAT: