diff options
author | Jaromir Wysoglad | 2019-07-22 17:19:52 -0700 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | 063107083340c9572250c75347ff4b7880a1770b (patch) | |
tree | c4a1f3ca03647c119ba5536142c1abe0dd7d28bf /common | |
parent | e4363ba2292cb2e1c1a02e7dcdb1914f469efe0b (diff) | |
download | scummvm-rg350-063107083340c9572250c75347ff4b7880a1770b.tar.gz scummvm-rg350-063107083340c9572250c75347ff4b7880a1770b.tar.bz2 scummvm-rg350-063107083340c9572250c75347ff4b7880a1770b.zip |
TTS: Fix state switching on windows
Voice is changed when changing language on windows, so when poping
state, the voice, that should get set has to be saved before
changing the language.
The speech shouldn't continue when changing state, so it is stopped
in pushState and popState.
Diffstat (limited to 'common')
-rw-r--r-- | common/text-to-speech.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/common/text-to-speech.cpp b/common/text-to-speech.cpp index 9289cba214..f9dc4c69aa 100644 --- a/common/text-to-speech.cpp +++ b/common/text-to-speech.cpp @@ -98,6 +98,7 @@ TextToSpeechManager::~TextToSpeechManager() { } void TextToSpeechManager::pushState() { + stop(); TTSState *newState = new TTSState; newState->_pitch = _ttsState->_pitch; newState->_volume = _ttsState->_volume; @@ -110,6 +111,7 @@ void TextToSpeechManager::pushState() { } bool TextToSpeechManager::popState() { + stop(); if (_ttsState->_next == nullptr) return true; @@ -118,11 +120,13 @@ bool TextToSpeechManager::popState() { delete oldState; + // The voice has to be saved, because some backends change it when changing language + int voice = _ttsState->_activeVoice; setLanguage(_ttsState->_language); setPitch(_ttsState->_pitch); setVolume(_ttsState->_volume); setRate(_ttsState->_rate); - setVoice(_ttsState->_activeVoice); + setVoice(voice); return false; } |