aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-14 23:39:26 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commit5e44796d6b4c117daf95635588f7d4c83602791e (patch)
tree37f04355fb8a8e528733cd3d2efabbbdda35479e /gui
parent5ee30a1b7342c21db8b32d4e87bdfa300a27a2b4 (diff)
downloadscummvm-rg350-5e44796d6b4c117daf95635588f7d4c83602791e.tar.gz
scummvm-rg350-5e44796d6b4c117daf95635588f7d4c83602791e.tar.bz2
scummvm-rg350-5e44796d6b4c117daf95635588f7d4c83602791e.zip
TTS: Add correct language switching
Diffstat (limited to 'gui')
-rw-r--r--gui/gui-manager.cpp13
-rw-r--r--gui/options.cpp19
2 files changed, 19 insertions, 13 deletions
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index f33fc39a6f..8cb201da3a 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -625,16 +625,21 @@ void GuiManager::setLastMousePos(int16 x, int16 y) {
#ifdef USE_TTS
void GuiManager::initTextToSpeech() {
-#if defined(USE_TRANSLATION) && defined(USE_LINUX_TTS)
- if(ConfMan.hasKey("gui_language") && ConfMan.get("gui_language") != "C")
- warning("TTS on linux is supported only for english");
+ Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
+#ifdef USE_TRANSLATION
+ Common::String currentLanguage = TransMan.getCurrentLanguage();
+ if (currentLanguage != "C") {
+ currentLanguage.setChar('\0', 2);
+ debug("%s", TransMan.getCurrentCharset().c_str());
+ ttsMan->setLanguage(currentLanguage);
+ }
#endif
int voice;
if(ConfMan.hasKey("tts_voice"))
voice = ConfMan.getInt("tts_voice", "scummvm");
else
voice = 0;
- g_system->getTextToSpeechManager()->setVoice(voice);
+ ttsMan->setVoice(voice);
}
#endif
diff --git a/gui/options.cpp b/gui/options.cpp
index e0e0cdf6b7..39bf6160ea 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -2149,19 +2149,20 @@ void GlobalOptionsDialog::apply() {
error.runModal();
}
#ifdef USE_TTS
- bool ttsCheckboxChanged = _ttsCheckbox->getState() &&
- (!ConfMan.hasKey("tts_enabled") || !ConfMan.getBool("tts_enabled"));
- bool languageChanged = (newLang != oldLang);
- if (ttsCheckboxChanged || languageChanged) {
-#if defined(USE_TRANSLATION) && defined(USE_LINUX_TTS)
- if (ConfMan.get("gui_language") != "C")
- warning("TTS on linux is supported only for english");
-#endif
+ Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
+ if (newLang != oldLang) {
+ if (newLang == "C")
+ ttsMan->setLanguage("en");
+ else {
+ Common::String guiLang = newLang;
+ guiLang.setChar('\0', 2);
+ ttsMan->setLanguage(guiLang);
+ }
}
ConfMan.setBool("tts_enabled", _ttsCheckbox->getState(), _domain);
int selectedVoice = _ttsVoiceSelectionPopUp->getSelectedTag();
ConfMan.setInt("tts_voice", selectedVoice, _domain);
- g_system->getTextToSpeechManager()->setVoice(selectedVoice);
+ ttsMan->setVoice(selectedVoice);
#endif
if (isRebuildNeeded) {