From 8357e8e6bf909353c3db720ba8fda9cdb0a41933 Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Mon, 15 Jul 2019 21:09:36 -0700 Subject: TTS: Prepare for windows TTS Add windows configuration in configure Add basic skeleton to backends Check if ttsMan is initialized in GUI --- gui/gui-manager.cpp | 2 ++ gui/options.cpp | 5 ++++- gui/widget.cpp | 5 ++++- gui/widgets/popup.cpp | 7 ++----- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'gui') diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 666e079aa6..c77af7c71f 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -626,6 +626,8 @@ void GuiManager::setLastMousePos(int16 x, int16 y) { #ifdef USE_TTS void GuiManager::initTextToSpeech() { Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan == nullptr) + return; #ifdef USE_TRANSLATION Common::String currentLanguage = TransMan.getCurrentLanguage(); if (currentLanguage != "C") { diff --git a/gui/options.cpp b/gui/options.cpp index 3195694935..71f8cadd15 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -1800,7 +1800,10 @@ void GlobalOptionsDialog::build() { _ttsCheckbox->setState(false); _ttsVoiceSelectionPopUp = new PopUpWidget(tab, "GlobalOptions_Accessibility.TTSVoiceSelection"); - Common::Array voices = g_system->getTextToSpeechManager()->getVoicesArray(); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + Common::Array voices; + if (ttsMan != nullptr) + voices = ttsMan->getVoicesArray(); for(unsigned i = 0; i < voices.size(); i++) { _ttsVoiceSelectionPopUp->appendEntry(voices[i].getDescription(), i); diff --git a/gui/widget.cpp b/gui/widget.cpp index 3269a5fd6c..f870eb52dc 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -260,7 +260,10 @@ void Widget::read(Common::String str) { #ifdef USE_TTS if (ConfMan.hasKey("tts_enabled", "scummvm") && ConfMan.getBool("tts_enabled", "scummvm")) { - g_system->getTextToSpeechManager()->say(str); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan == nullptr) + return; + ttsMan->say(str); } #endif } diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp index fe51b39c10..532127a422 100644 --- a/gui/widgets/popup.cpp +++ b/gui/widgets/popup.cpp @@ -227,11 +227,8 @@ void PopUpDialog::read(Common::String str) { #ifdef USE_TTS if (ConfMan.hasKey("tts_enabled", "scummvm") && ConfMan.getBool("tts_enabled", "scummvm")) { - int volume = (ConfMan.getInt("speech_volume", "scummvm") * 100) / 256; - if (ConfMan.hasKey("mute", "scummvm") && ConfMan.getBool("mute", "scummvm")) - volume = 0; - g_system->getTextToSpeechManager()->setVolume(volume); - g_system->getTextToSpeechManager()->say(str); + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + ttsMan->say(str); } #endif } -- cgit v1.2.3