Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: voice in keyboard.c

voice in keyboard.c

From: Christopher Moore <christopher.h.moore_at_verizon.net>
Date: Mon, 3 May 2004 15:34:08 -0400

Hello,
Below is a simple patch to keyboard.c which gives voice output when renaming
files/directories or creating directories. Voice output has been added to
the following keys:
left, right, on+left, on+right and play.

I've only tested the patch on an fmr and have not looked into whether the
same logic would work on the player side. If anyone wishes to test this on
an fmr, I can send a prebuilt binary (.ajz file) privately.

Chris


--- apps/recorder/keyboard.c.orig 2004-04-30 15:40:36.000000000 -0400
+++ apps/recorder/keyboard.c 2004-05-03 14:48:41.000000000 -0400
_at__at_ -26,6 +26,7 _at__at_
 #include "font.h"
 #include "screens.h"
 #include "status.h"
+#include "talk.h"
 
 #define KEYBOARD_LINES 4
 #define KEYBOARD_PAGES 3
_at__at_ -72,6 +73,7 _at__at_
 
     char outline[256];
     char c = 0;
+ char spell_char[2]; /* store char to pass to talk_spell */
     struct font* font = font_get(FONT_SYSFIXED);
 
     lcd_setfont(FONT_SYSFIXED);
_at__at_ -89,6 +91,7 _at__at_
     max_chars = LCD_WIDTH / font_w;
     kbd_setupkeys(line, page);
 
+ talk_spell(text, true); /* spell initial test */
     while(!done)
     {
         len = strlen(text);
_at__at_ -193,7 +196,12 _at__at_
             case BUTTON_RIGHT:
             case BUTTON_RIGHT | BUTTON_REPEAT:
                 if (x < (int)strlen(line[y]) - 1)
+ {
                     x++;
+ spell_char[0] = line[y][x];
+ spell_char[1] = '\0'; /* mark end of char string */
+ talk_spell(spell_char, false);
+ }
                 else
                     x = 0;
                 break;
_at__at_ -201,7 +209,12 _at__at_
             case BUTTON_LEFT:
             case BUTTON_LEFT | BUTTON_REPEAT:
                 if (x)
+ {
                     x--;
+ spell_char[0] = line[y][x];
+ spell_char[1] = '\0'; /* mark end of char string */
+ talk_spell(spell_char, false);
+ }
                 else
                     x = strlen(line[y]) - 1;
                 break;
_at__at_ -261,6 +274,7 _at__at_
                     }
                     editpos++;
                 }
+ talk_spell(text, false); /* speak revised text */
                 break;
 
             case BUTTON_ON | BUTTON_RIGHT:
_at__at_ -269,6 +283,11 _at__at_
                 editpos++;
                 if (editpos > len)
                     editpos = len;
+ else
+ {
+ spell_char[0] = text[editpos-1];
+ talk_spell(spell_char, false);
+ }
                 break;
 
             case BUTTON_ON | BUTTON_LEFT:
_at__at_ -277,6 +296,11 _at__at_
                 editpos--;
                 if (editpos < 0)
                     editpos = 0;
+ else
+ {
+ spell_char[0] = text[editpos];
+ talk_spell(spell_char, false);
+ }
                 break;
 
             case SYS_USB_CONNECTED:
_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox
Received on 2004-05-03

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy