aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
Diffstat (limited to 'backends')
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.cpp13
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.h1
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;