TTS: Implement speech queueing on Linux and Win

This commit is contained in:
Jaromir Wysoglad 2019-07-31 15:10:12 +02:00 committed by Filippos Karapetis
parent bbbb608c52
commit 6703f88f7f
5 changed files with 36 additions and 16 deletions

View file

@ -128,9 +128,12 @@ Common::String LinuxTextToSpeechManager::strToUtf8(Common::String str, Common::S
#endif
}
bool LinuxTextToSpeechManager::say(Common::String str, Common::String charset) {
bool LinuxTextToSpeechManager::say(Common::String str, Action action, Common::String charset) {
if (_speechState == BROKEN)
return true;
if (action == DROP && isSpeaking())
return true;
if (charset.empty()) {
#ifdef USE_TRANSLATION
@ -142,7 +145,7 @@ bool LinuxTextToSpeechManager::say(Common::String str, Common::String charset) {
str = strToUtf8(str, charset);
if (isSpeaking())
if (isSpeaking() && action == INTERRUPT)
stop();
if(spd_say(_connection, SPD_MESSAGE, str.c_str()) == -1) {
//restart the connection