diff options
author | Jaromir Wysoglad | 2019-08-01 23:34:58 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | 1234f8e42fbcb5da16744deaa62c186778f14184 (patch) | |
tree | 2b889e2ec16cc72d650cb671fd6b4638eb436212 /backends/text-to-speech | |
parent | a5c9e8c74b11a96c1c411414a52bedd88193b350 (diff) | |
download | scummvm-rg350-1234f8e42fbcb5da16744deaa62c186778f14184.tar.gz scummvm-rg350-1234f8e42fbcb5da16744deaa62c186778f14184.tar.bz2 scummvm-rg350-1234f8e42fbcb5da16744deaa62c186778f14184.zip |
TTS: Fix pause() and resume() on linux
Diffstat (limited to 'backends/text-to-speech')
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.cpp | 13 |
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() { |