diff options
author | Jaromir Wysoglad | 2019-07-14 21:01:37 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | e801e83f4385b4c4652fa30b66af4b396e45c0da (patch) | |
tree | db0f171c2a636546e6b9f65535820493d2593ebd /backends/text-to-speech | |
parent | a9eaf46c421e7cb5731b99b138f982fdc9bb3833 (diff) | |
download | scummvm-rg350-e801e83f4385b4c4652fa30b66af4b396e45c0da.tar.gz scummvm-rg350-e801e83f4385b4c4652fa30b66af4b396e45c0da.tar.bz2 scummvm-rg350-e801e83f4385b4c4652fa30b66af4b396e45c0da.zip |
TTS: Restart spd connection on speak error.
Diffstat (limited to 'backends/text-to-speech')
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.cpp | 13 | ||||
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.h | 1 |
2 files changed, 13 insertions, 1 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 110bb8396e..3445ca972a 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.cpp +++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp @@ -65,6 +65,10 @@ void speech_pause_callback(size_t msg_id, size_t client_id, SPDNotificationType LinuxTextToSpeechManager::LinuxTextToSpeechManager() : _speechState(READY) { + init(); +} + +void LinuxTextToSpeechManager::init() { _connection = spd_open("ScummVM", "main", NULL, SPD_MODE_THREADED); if (_connection == 0) { _speechState = BROKEN; @@ -103,7 +107,14 @@ bool LinuxTextToSpeechManager::say(Common::String str) { if (isSpeaking()) stop(); debug("say: %s", str.c_str()); - return spd_say(_connection, SPD_MESSAGE, str.c_str()) == -1; + if(spd_say(_connection, SPD_MESSAGE, str.c_str()) == -1) { + //restart the connection + if (_connection != 0) + spd_close(_connection); + init(); + return true; + } + return false; } diff --git a/backends/text-to-speech/linux/linux-text-to-speech.h b/backends/text-to-speech/linux/linux-text-to-speech.h index 41c4a64d28..d08da49425 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.h +++ b/backends/text-to-speech/linux/linux-text-to-speech.h @@ -66,6 +66,7 @@ public: void updateState(SpeechState state); private: + void init(); virtual void updateVoices(); void createVoice(int typeNumber, Common::TTSVoice::Gender, char *description); SpeechState _speechState; |