TTS: Fix crash when TextToSpeechManager is unavailable, clean up formatting
This commit is contained in:
parent
30c00656e1
commit
cc5abf5ebb
10 changed files with 70 additions and 54 deletions
|
@ -553,13 +553,17 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
|
|||
#endif
|
||||
#ifdef USE_TTS
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr) {
|
||||
ttsMan->pushState();
|
||||
}
|
||||
#endif
|
||||
// Try to run the game
|
||||
Common::Error result = runGame(plugin, system, specialDebug);
|
||||
|
||||
#ifdef USE_TTS
|
||||
if (ttsMan != nullptr) {
|
||||
ttsMan->popState();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_EVENTRECORDER
|
||||
|
|
|
@ -564,8 +564,10 @@ void Engine::openMainMenuDialog() {
|
|||
_mainMenuDialog = new MainMenuDialog(this);
|
||||
#ifdef USE_TTS
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr) {
|
||||
ttsMan->pushState();
|
||||
g_gui.initTextToSpeech();
|
||||
}
|
||||
#endif
|
||||
|
||||
setGameToLoadSlot(-1);
|
||||
|
@ -590,6 +592,7 @@ void Engine::openMainMenuDialog() {
|
|||
applyGameSettings();
|
||||
syncSoundSettings();
|
||||
#ifdef USE_TTS
|
||||
if (ttsMan != nullptr)
|
||||
ttsMan->popState();
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -115,7 +115,6 @@ static const LureGameDescription gameDescriptions[] = {
|
|||
#else
|
||||
GUIO0()
|
||||
#endif
|
||||
|
||||
},
|
||||
GF_FLOPPY | GF_EGA,
|
||||
},
|
||||
|
|
|
@ -488,9 +488,11 @@ Surface *Surface::newDialog(uint16 width, uint8 numLines, const char **lines, bo
|
|||
|
||||
#ifdef USE_TTS
|
||||
if (ConfMan.getBool("tts_narrator")) {
|
||||
Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager();
|
||||
_ttsMan->stop();
|
||||
_ttsMan->say(text.c_str());
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr) {
|
||||
ttsMan->stop();
|
||||
ttsMan->say(text.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -201,8 +201,9 @@ int TextDialog::estimatePieces(int maxLen) {
|
|||
TextDialog::~TextDialog() {
|
||||
#ifdef USE_TTS
|
||||
if (ConfMan.getBool("tts_narrator")) {
|
||||
Common::TextToSpeechManager* _ttsMan = g_system->getTextToSpeechManager();
|
||||
_ttsMan->stop();
|
||||
Common::TextToSpeechManager* ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr)
|
||||
ttsMan->stop();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -389,9 +390,11 @@ void TextDialog::draw() {
|
|||
|
||||
#ifdef USE_TTS
|
||||
if (ConfMan.getBool("tts_narrator")) {
|
||||
Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager();
|
||||
_ttsMan->stop();
|
||||
_ttsMan->say(text.c_str());
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr) {
|
||||
ttsMan->stop();
|
||||
ttsMan->say(text.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -2066,9 +2066,11 @@ void ScalpelUserInterface::printObjectDesc(const Common::String &str, bool first
|
|||
|
||||
#ifdef USE_TTS
|
||||
if (ConfMan.getBool("tts_narrator")) {
|
||||
Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager();
|
||||
_ttsMan->stop();
|
||||
_ttsMan->say(str.c_str());
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr) {
|
||||
ttsMan->stop();
|
||||
ttsMan->say(str.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -359,9 +359,11 @@ void Talk::talkTo(const Common::String filename) {
|
|||
|
||||
#ifdef USE_TTS
|
||||
if (_talkTo == -1 && ConfMan.getBool("tts_narrator")) {
|
||||
Common::TextToSpeechManager *_ttsMan = g_system->getTextToSpeechManager();
|
||||
_ttsMan->stop();
|
||||
_ttsMan->say(_statements[select]._reply.c_str());
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr) {
|
||||
ttsMan->stop();
|
||||
ttsMan->say(_statements[select]._reply.c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -200,6 +200,7 @@ void PopUpDialog::read(Common::String str) {
|
|||
if (ConfMan.hasKey("tts_enabled", "scummvm") &&
|
||||
ConfMan.getBool("tts_enabled", "scummvm")) {
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan != nullptr)
|
||||
ttsMan->say(str);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue