From 4f36ea8fbf877e8af938c0bb16591f3c6cffd4f8 Mon Sep 17 00:00:00 2001 From: Jörg Hohensohn Date: Sun, 14 Mar 2004 21:33:53 +0000 Subject: 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 --- apps/menu.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'apps/menu.c') diff --git a/apps/menu.c b/apps/menu.c index f187b5d82b..f9443548f6 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 @@ static void put_cursor(int m, int target) 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 @@ int menu_show(int m) { bool exit = false; int key; + int voice_id; #ifdef HAVE_LCD_BITMAP int fw, fh; int menu_lines; @@ -263,9 +272,16 @@ int menu_show(int m) 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 @@ int menu_show(int m) 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: -- cgit v1.2.3