aboutsummaryrefslogtreecommitdiff
path: root/backends/text-to-speech
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-08-01 21:24:23 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commit7ec4f03a0824d2ee16c24cf995ce4900ecb556af (patch)
tree6f975a253da325fb20271ed6681a4ed00c298503 /backends/text-to-speech
parent9ca2602e82429cf3b210f363e0a478fd876a13b5 (diff)
downloadscummvm-rg350-7ec4f03a0824d2ee16c24cf995ce4900ecb556af.tar.gz
scummvm-rg350-7ec4f03a0824d2ee16c24cf995ce4900ecb556af.tar.bz2
scummvm-rg350-7ec4f03a0824d2ee16c24cf995ce4900ecb556af.zip
TTS: Make state switching faster on Linux
Diffstat (limited to 'backends/text-to-speech')
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/backends/text-to-speech/linux/linux-text-to-speech.cpp b/backends/text-to-speech/linux/linux-text-to-speech.cpp
index a2a09aebdc..c5ff8e0858 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.cpp
+++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp
@@ -147,6 +147,8 @@ bool LinuxTextToSpeechManager::say(Common::String str, Action action, Common::St
if (isSpeaking() && action == INTERRUPT)
stop();
+ if (str.size() != 0)
+ _speechState = SPEAKING;
if(spd_say(_connection, SPD_MESSAGE, str.c_str()) == -1) {
//restart the connection
if (_connection != 0)
@@ -154,24 +156,28 @@ bool LinuxTextToSpeechManager::say(Common::String str, Action action, Common::St
init();
return true;
}
+
return false;
}
bool LinuxTextToSpeechManager::stop() {
if (_speechState == READY || _speechState == BROKEN)
return true;
+ _speechState = READY;
return spd_cancel(_connection) == -1;
}
bool LinuxTextToSpeechManager::pause() {
if (_speechState == READY || _speechState == PAUSED || _speechState == BROKEN)
return true;
+ _speechState = PAUSED;
return spd_pause(_connection) == -1;
}
bool LinuxTextToSpeechManager::resume() {
if (_speechState == READY || _speechState == SPEAKING || _speechState == BROKEN)
return true;
+ _speechState = SPEAKING;
return spd_resume(_connection) == -1;
}