From 5b76936a44de3c7ecd568300f26b5e6421901285 Mon Sep 17 00:00:00 2001 From: Nils Wallménius Date: Mon, 6 Aug 2007 13:08:36 +0000 Subject: Accept FS#6159 'Add voice to roughly 100 splash screens and yes-no menus' by Stephane Doyon with some minor tweaks by me. Rerun 'configure' and do a 'make clean' before rebuilding your voice files. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14213 a1c6a512-1295-4272-9138-f99709370657 --- apps/talk.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'apps/talk.h') 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 */ int talk_get_bufsize(void); /* get the loaded voice file size */ /* talk_buffer_steal - on SWCODEC, for use by buffer functions only */ int talk_buffer_steal(void); /* claim the mp3 buffer e.g. for play/record */ +//int shutup(void); /* Interrupt voice, as when enqueue is false */ +//int do_shutup(void); /* kill voice unconditionally */ +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 */ @@ -74,4 +77,37 @@ 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 */ + +/* Enqueue next utterance even if enqueue parameter is false: don't + interrupt the current utterance. */ +void talk_force_enqueue_next(void); + +/* speaks one or more IDs (from an array)). */ +int talk_idarray(long *idarray, bool enqueue); +/* This (otherwise invalid) ID signals the end of the array. */ +#define TALK_FINAL_ID LANG_LAST_INDEX_IN_ARRAY +/* This makes an initializer for the array of IDs and takes care to + put the final sentinel element at the end. */ +#define TALK_IDARRAY(ids...) ((long[]){ids,TALK_FINAL_ID}) +/* And this handy macro makes it look like a variadic function. */ +#define talk_ids(enqueue, ids...) talk_idarray(TALK_IDARRAY(ids), enqueue) +/* This version talks only if talking menus are enabled, and does not + enqueue the initial id. */ +#define cond_talk_ids(ids...) do { \ + if (talk_menus_enabled()) \ + talk_ids(false, ids); \ + } while(0) +/* And a version that takes the array parameter... */ +#define cond_talk_idarray(idarray) do { \ + if (talk_menus_enabled() \ + talk_idarray(idarray, false); \ + } while(0) +/* Convenience macro to conditionally speak something and not have + it interrupted. */ +#define cond_talk_ids_fq(ids...) do { \ + if (talk_menus_enabled()) { \ + talk_ids(false, ids); \ + talk_force_enqueue_next(); \ + } \ + }while(0) #endif /* __TALK_H__ */ -- cgit v1.2.3