diff options
Diffstat (limited to 'apps/talk.h')
-rw-r--r-- | apps/talk.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/talk.h b/apps/talk.h index d5a6bc7060..d471ec7ca8 100644 --- a/apps/talk.h +++ b/apps/talk.h | |||
@@ -66,6 +66,9 @@ bool talk_voice_required(void); /* returns true if voice codec required */ | |||
66 | int talk_get_bufsize(void); /* get the loaded voice file size */ | 66 | int talk_get_bufsize(void); /* get the loaded voice file size */ |
67 | /* talk_buffer_steal - on SWCODEC, for use by buffer functions only */ | 67 | /* talk_buffer_steal - on SWCODEC, for use by buffer functions only */ |
68 | int talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */ | 68 | int talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */ |
69 | //int shutup(void); /* Interrupt voice, as when enqueue is false */ | ||
70 | //int do_shutup(void); /* kill voice unconditionally */ | ||
71 | bool is_voice_queued(void); /* Are there more voice clips to be spoken? */ | ||
69 | int talk_id(long id, bool enqueue); /* play a voice ID from voicefont */ | 72 | int talk_id(long id, bool enqueue); /* play a voice ID from voicefont */ |
70 | int talk_file(const char* filename, bool enqueue); /* play a thumbnail from file */ | 73 | int talk_file(const char* filename, bool enqueue); /* play a thumbnail from file */ |
71 | int talk_number(long n, bool enqueue); /* say a number */ | 74 | int talk_number(long n, bool enqueue); /* say a number */ |
@@ -74,4 +77,37 @@ int talk_spell(const char* spell, bool enqueue); /* spell a string */ | |||
74 | bool talk_menus_enabled(void); /* returns true if menus should be voiced */ | 77 | bool talk_menus_enabled(void); /* returns true if menus should be voiced */ |
75 | void talk_disable_menus(void); /* disable voice menus (temporarily, not persisted) */ | 78 | void talk_disable_menus(void); /* disable voice menus (temporarily, not persisted) */ |
76 | void talk_enable_menus(void); /* re-enable voice menus */ | 79 | void talk_enable_menus(void); /* re-enable voice menus */ |
80 | |||
81 | /* Enqueue next utterance even if enqueue parameter is false: don't | ||
82 | interrupt the current utterance. */ | ||
83 | void talk_force_enqueue_next(void); | ||
84 | |||
85 | /* speaks one or more IDs (from an array)). */ | ||
86 | int talk_idarray(long *idarray, bool enqueue); | ||
87 | /* This (otherwise invalid) ID signals the end of the array. */ | ||
88 | #define TALK_FINAL_ID LANG_LAST_INDEX_IN_ARRAY | ||
89 | /* This makes an initializer for the array of IDs and takes care to | ||
90 | put the final sentinel element at the end. */ | ||
91 | #define TALK_IDARRAY(ids...) ((long[]){ids,TALK_FINAL_ID}) | ||
92 | /* And this handy macro makes it look like a variadic function. */ | ||
93 | #define talk_ids(enqueue, ids...) talk_idarray(TALK_IDARRAY(ids), enqueue) | ||
94 | /* This version talks only if talking menus are enabled, and does not | ||
95 | enqueue the initial id. */ | ||
96 | #define cond_talk_ids(ids...) do { \ | ||
97 | if (talk_menus_enabled()) \ | ||
98 | talk_ids(false, ids); \ | ||
99 | } while(0) | ||
100 | /* And a version that takes the array parameter... */ | ||
101 | #define cond_talk_idarray(idarray) do { \ | ||
102 | if (talk_menus_enabled() \ | ||
103 | talk_idarray(idarray, false); \ | ||
104 | } while(0) | ||
105 | /* Convenience macro to conditionally speak something and not have | ||
106 | it interrupted. */ | ||
107 | #define cond_talk_ids_fq(ids...) do { \ | ||
108 | if (talk_menus_enabled()) { \ | ||
109 | talk_ids(false, ids); \ | ||
110 | talk_force_enqueue_next(); \ | ||
111 | } \ | ||
112 | }while(0) | ||
77 | #endif /* __TALK_H__ */ | 113 | #endif /* __TALK_H__ */ |