TTS: Add correct language switching
This commit is contained in:
parent
5ee30a1b73
commit
5e44796d6b
2 changed files with 19 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue