All pastes #715106 Raw Edit

Something

public text v1 · immutable
#715106 ·published 2007-09-26 01:05 UTC
rendered paste body
Index: tools/genlang
===================================================================
--- tools/genlang	(revision 14854)
+++ tools/genlang	(working copy)
@@ -529,6 +529,18 @@
 /* this contains the concatenation of all strings, separated by \\0 chars */
 extern const unsigned char language_builtin[];
 
+#include "${prefix}_enum.h"
+
+MOO
+    ;
+
+    close(HFILE);
+
+    open(HFILE, ">${prefix}_enum.h") ||
+        die "couldn't create file ${prefix}_enum.h\n";
+
+    print HFILE <<MOO
+/* This file was automatically generated using genlang */
 /* The enum below contains all available strings */
 enum \{
 MOO
Index: apps/lang/english.lang
===================================================================
--- apps/lang/english.lang	(revision 14854)
+++ apps/lang/english.lang	(working copy)
@@ -11242,3 +11242,59 @@
     usbstack: "Device Driver"
   </voice>
 </phrase>
+<phrase>
+  id: VOICE_FILES_IN_DIR 
+  desc: in stats plugin
+  user:
+  <source>
+    *: none  
+</source>
+  <dest>
+    *: none
+  </dest>
+  <voice>
+    *: "Files in directory"
+  </voice>
+</phrase>
+<phrase>
+  id: VOICE_DIRS
+  desc: in stats plugin
+  user:
+  <source>
+    *: none  
+</source>
+  <dest>
+    *: none
+  </dest>
+  <voice>
+    *: "Directories"
+  </voice>
+</phrase>
+<phrase>
+  id: VOICE_MUSICFILES  
+desc: in stats plugin
+  user:
+  <source>
+    *: none  
+</source>
+  <dest>
+    *: none
+  </dest>
+  <voice>
+    *: "Music files"
+  </voice>
+</phrase>
+<phrase>
+  id: VOICE_LARGESTDIR
+desc: in stats plugin
+  user:
+  <source>
+    *: none  
+</source>
+  <dest>
+    *: none
+  </dest>
+  <voice>
+    *: "Largest directory"
+  </voice>
+</phrase>
\ No newline at end of file
Index: apps/plugins/stats.c
===================================================================
--- apps/plugins/stats.c	(revision 14854)
+++ apps/plugins/stats.c	(working copy)
@@ -17,6 +17,7 @@
  *
  ****************************************************************************/
 #include "plugin.h"
+#include "lang_enum.h"
 
 PLUGIN_HEADER
 
@@ -99,7 +100,6 @@
     rb->snprintf(buf, sizeof(buf), "Dirs: %5d", dirs);
     prn(buf,1);
 #endif
-
     rb->lcd_update();
 #ifdef HAVE_REMOTE_LCD
     rb->lcd_remote_update();
@@ -163,6 +163,14 @@
     }
     if (largestdir < files_in_dir)
         largestdir = files_in_dir;
+            if (rb->talk_menus_enabled())
+            {
+                rb->talk_value(files_in_dir, UNIT_FILES_IN_DIR, true);
+                rb->talk_value(files, UNIT_FILES, true);
+                rb->talk_value(dirs, UNIT_DIRS, true);
+                rb->talk_value(musicfiles, UNIT_MUSICFILES, true);
+                rb->talk_value(largestdir, UNIT_LARGESTDIR, true);
+            }
 }
 
 enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
@@ -179,12 +187,16 @@
     abort = false;
 
     rb->splash(HZ, "Counting...");
+    if (rb->talk_menus_enabled())
+        rb->talk_id(LANG_COUNTING, true);
     update_screen();
     lasttick = *rb->current_tick;
 
     traversedir("", "");
     if (abort == true) {
         rb->splash(HZ, "Aborted");
+            if (rb->talk_menus_enabled())
+                rb->talk_id(LANG_ABORTED, true);
         return PLUGIN_OK;
     }
     update_screen();
@@ -193,6 +205,8 @@
 #endif
     rb->backlight_on();
     rb->splash(HZ, "Done");
+    if (rb->talk_menus_enabled())
+        rb->talk_id(LANG_DONE, true);
     update_screen();
     button = rb->button_get(true);
     while (1) {
Index: apps/talk.c
===================================================================
--- apps/talk.c	(revision 14854)
+++ apps/talk.c	(working copy)
@@ -783,6 +783,16 @@
             = VOICE_KBIT_PER_SEC,
         [UNIT_PM_TICK]
             = VOICE_PM_UNITS_PER_TICK,
+        [UNIT_FILES_IN_DIR]
+            = VOICE_FILES_IN_DIR,
+        [UNIT_FILES]
+            = LANG_DIR_BROWSER,
+        [UNIT_DIRS]
+            = VOICE_DIRS,
+        [UNIT_MUSICFILES]
+            = VOICE_MUSICFILES,
+        [UNIT_LARGESTDIR]
+            = VOICE_LARGESTDIR,
     };
 
 #if CONFIG_CODEC != SWCODEC
Index: apps/talk.h
===================================================================
--- apps/talk.h	(revision 14854)
+++ apps/talk.h	(working copy)
@@ -33,6 +33,11 @@
     UNIT_MS,      /* milliseconds */
     UNIT_SEC,     /* seconds */
     UNIT_MIN,     /* minutes */
+    UNIT_FILES_IN_DIR, 
+    UNIT_FILES,
+    UNIT_DIRS,
+    UNIT_MUSICFILES,
+    UNIT_LARGESTDIR,
     UNIT_HOUR,    /* hours */
     UNIT_KHZ,     /* kHz */
     UNIT_DB,      /* dB, mandatory sign */
@@ -45,7 +50,7 @@
     UNIT_KBIT,    /* kilobits per sec */
     UNIT_PM_TICK, /* peak meter units per tick */
     UNIT_LAST     /* END MARKER */
-};
+    };
 
 #define UNIT_SHIFT (32-5) /* this many bits left from UNIT_xx enum */
 
Index: apps/plugin.c
===================================================================
--- apps/plugin.c	(revision 14854)
+++ apps/plugin.c	(working copy)
@@ -235,6 +235,18 @@
     mkdir,
     rmdir,
 
+    /* talking */
+    is_voice_queued,
+    talk_id,
+    talk_file,
+    talk_number,
+    talk_value,
+    talk_spell,
+    talk_menus_enabled,
+    talk_disable_menus,
+    talk_enable_menus,
+    do_shutup,
+
     /* kernel/ system */
     PREFIX(sleep),
     yield,
Index: apps/plugin.h
===================================================================
--- apps/plugin.h	(revision 14854)
+++ apps/plugin.h	(working copy)
@@ -324,6 +324,18 @@
     int (*mkdir)(const char *name);
     int (*rmdir)(const char *name);
 
+    /* talking */
+    bool (*is_voice_queued)(void); /* Are there more voice clips to be spoken? */
+    int (*talk_id)(long id, bool enqueue); /* play a voice ID from voicefont */
+    int (*talk_file)(const char* filename, bool enqueue); /* play a thumbnail from file */
+    int (*talk_number)(long n, bool enqueue); /* say a number */
+    int (*talk_value)(long n, int unit, bool enqueue); /* say a numeric value */
+    int (*talk_spell)(const char* spell, bool enqueue); /* spell a string */
+    bool (*talk_menus_enabled)(void); /* returns true if menus should be voiced */
+    void (*talk_disable_menus)(void); /* disable voice menus (temporarily, not persisted) */
+    void (*talk_enable_menus)(void); /* re-enable voice menus */
+    int (*do_shutup)(void); /* kill voice unconditionally */
+
     /* kernel/ system */
     void (*PREFIX(sleep))(int ticks);
     void (*yield)(void);