From 4bae32ffe7952ca967b16c8043c1957e9a3379b2 Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Fri, 2 Aug 2019 01:50:59 +0200 Subject: TTS: Add *_NO_REPEAT actions --- backends/text-to-speech/windows/windows-text-to-speech.cpp | 8 ++++++++ backends/text-to-speech/windows/windows-text-to-speech.h | 1 + 2 files changed, 9 insertions(+) (limited to 'backends/text-to-speech/windows') diff --git a/backends/text-to-speech/windows/windows-text-to-speech.cpp b/backends/text-to-speech/windows/windows-text-to-speech.cpp index 0731239054..d0254fccb2 100644 --- a/backends/text-to-speech/windows/windows-text-to-speech.cpp +++ b/backends/text-to-speech/windows/windows-text-to-speech.cpp @@ -88,6 +88,7 @@ void WindowsTextToSpeechManager::init() { _speechState = READY; else _speechState = NO_VOICE; + _lastSaid = ""; } WindowsTextToSpeechManager::~WindowsTextToSpeechManager() { @@ -105,6 +106,12 @@ bool WindowsTextToSpeechManager::say(Common::String str, Action action, Common:: if (isSpeaking() && action == DROP) return true; + if (isSpeaking() && action == INTERRUPT_NO_REPEAT && _lastSaid == str) + return true; + + if (isSpeaking() && action == QUEUE_NO_REPEAT && _lastSaid == str) + return true; + if (charset.empty()) { #ifdef USE_TRANSLATION charset = TransMan.getCurrentCharset(); @@ -112,6 +119,7 @@ bool WindowsTextToSpeechManager::say(Common::String str, Action action, Common:: charset = "ASCII"; #endif } + _lastSaid = str; // We have to set the pitch by prepending xml code at the start of the said string; Common::String pitch= Common::String::format("", _ttsState->_pitch / 10); str.replace((uint32)0, 0, pitch); diff --git a/backends/text-to-speech/windows/windows-text-to-speech.h b/backends/text-to-speech/windows/windows-text-to-speech.h index 7a02c193ce..d8968243ec 100644 --- a/backends/text-to-speech/windows/windows-text-to-speech.h +++ b/backends/text-to-speech/windows/windows-text-to-speech.h @@ -71,6 +71,7 @@ private: void createVoice(void *cpVoiceToken); Common::String lcidToLocale(Common::String lcid); SpeechState _speechState; + Common::String _lastSaid; }; #endif -- cgit v1.2.3