From 6703f88f7f91bc22ce5ea3593a1699f1dc4fa7c0 Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Wed, 31 Jul 2019 15:10:12 +0200 Subject: TTS: Implement speech queueing on Linux and Win --- common/text-to-speech.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/text-to-speech.h b/common/text-to-speech.h index 004de3116b..b776a1cae3 100644 --- a/common/text-to-speech.h +++ b/common/text-to-speech.h @@ -136,6 +136,11 @@ struct TTSState { */ class TextToSpeechManager { public: + enum Action { + INTERRUPT, + QUEUE, + DROP + }; /** * The constructor sets the language to the translation manager language if * USE_TRANSLATION is defined, or english when it isn't defined. It sets the rate, @@ -144,14 +149,24 @@ public: TextToSpeechManager(); virtual ~TextToSpeechManager(); + /** + * Interrupts what's being said and says the given string + * + * @param str The string to say + * @param charset The encoding of the string. If empty this is assumed to be the + * encoding used for the GUI. + */ + virtual bool say(String str, String charset = "") { return say(str, INTERRUPT, charset); } + /** * Says the given string * * @param str The string to say + * @param action What to do if another string is just being said. * @param charset The encoding of the string. If empty this is assumed to be the * encoding used for the GUI. */ - virtual bool say(String str, String charset = "") { return false; } + virtual bool say(String str, Action action, String charset = "") { return false; } /** * Stops the speech -- cgit v1.2.3