diff options
author | Jaromir Wysoglad | 2019-07-18 12:19:47 -0700 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | 4d9572073192a3cefe7b148a27197c2ca9f60087 (patch) | |
tree | 4e0ef6abed7d05b7380b6840ad0b0cdff8361af7 | |
parent | 5d9f03e71d75a307c8f8e538803fe2f09f38c5ae (diff) | |
download | scummvm-rg350-4d9572073192a3cefe7b148a27197c2ca9f60087.tar.gz scummvm-rg350-4d9572073192a3cefe7b148a27197c2ca9f60087.tar.bz2 scummvm-rg350-4d9572073192a3cefe7b148a27197c2ca9f60087.zip |
TTS: Fix voice setting on startup
The ScummVM was crashing because of an assert, when there was less
voices availaible, than what was set in the ConfMan.
Now the voice just falls back to 0th voice, if there are not
enough voices.
-rw-r--r-- | backends/text-to-speech/windows/windows-text-to-speech.cpp | 1 | ||||
-rw-r--r-- | gui/gui-manager.cpp | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/backends/text-to-speech/windows/windows-text-to-speech.cpp b/backends/text-to-speech/windows/windows-text-to-speech.cpp index fec5a408d1..e9f28d966b 100644 --- a/backends/text-to-speech/windows/windows-text-to-speech.cpp +++ b/backends/text-to-speech/windows/windows-text-to-speech.cpp @@ -49,7 +49,6 @@ ISpAudio *_audio; WindowsTextToSpeechManager::WindowsTextToSpeechManager() : _speechState(BROKEN){ - ConfMan.setInt("tts_voice", 0); init(); } diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index b149908ffe..82f7591ae8 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -645,6 +645,8 @@ void GuiManager::initTextToSpeech() { voice = ConfMan.getInt("tts_voice", "scummvm"); else voice = 0; + if (voice >= ttsMan->getVoicesArray().size()) + voice = 0; ttsMan->setVoice(voice); } #endif |