aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-08-01 23:34:58 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commit1234f8e42fbcb5da16744deaa62c186778f14184 (patch)
tree2b889e2ec16cc72d650cb671fd6b4638eb436212
parenta5c9e8c74b11a96c1c411414a52bedd88193b350 (diff)
downloadscummvm-rg350-1234f8e42fbcb5da16744deaa62c186778f14184.tar.gz
scummvm-rg350-1234f8e42fbcb5da16744deaa62c186778f14184.tar.bz2
scummvm-rg350-1234f8e42fbcb5da16744deaa62c186778f14184.zip
TTS: Fix pause() and resume() on linux
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.cpp13
1 files changed, 11 insertions, 2 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 c5ff8e0858..c63c4c7dc7 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.cpp
+++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp
@@ -51,7 +51,10 @@ void speech_end_callback(size_t msg_id, size_t client_id, SPDNotificationType st
void speech_cancel_callback(size_t msg_id, size_t client_id, SPDNotificationType state){
LinuxTextToSpeechManager *manager =
static_cast<LinuxTextToSpeechManager *> (g_system->getTextToSpeechManager());
- manager->updateState(LinuxTextToSpeechManager::READY);
+ if (manager->isSpeaking())
+ manager->updateState(LinuxTextToSpeechManager::READY);
+ if (manager->isPaused())
+ manager->updateState(LinuxTextToSpeechManager::PAUSED);
}
void speech_resume_callback(size_t msg_id, size_t client_id, SPDNotificationType state){
@@ -170,8 +173,14 @@ bool LinuxTextToSpeechManager::stop() {
bool LinuxTextToSpeechManager::pause() {
if (_speechState == READY || _speechState == PAUSED || _speechState == BROKEN)
return true;
+ bool result = spd_pause_all(_connection) == -1;
+ if (result)
+ return true;
+ result = spd_stop(_connection) == -1;
+ if (result)
+ return true;
_speechState = PAUSED;
- return spd_pause(_connection) == -1;
+ return false;
}
bool LinuxTextToSpeechManager::resume() {