TTS: Implement tts state switching when needed.

The state has to be pushed and poped when there is a transition
between game and gui code.
This commit is contained in:
Jaromir Wysoglad 2019-07-22 19:42:30 +02:00 committed by Filippos Karapetis
parent 33549d9c02
commit 324a90f4f6
3 changed files with 21 additions and 1 deletions

View file

@ -557,10 +557,18 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
debug("info:author=%s name=%s description=%s", record.getHeader().author.c_str(), record.getHeader().name.c_str(), record.getHeader().description.c_str()); debug("info:author=%s name=%s description=%s", record.getHeader().author.c_str(), record.getHeader().name.c_str(), record.getHeader().description.c_str());
break; break;
} }
#endif
#ifdef USE_TTS
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->pushState();
#endif #endif
// Try to run the game // Try to run the game
Common::Error result = runGame(plugin, system, specialDebug); Common::Error result = runGame(plugin, system, specialDebug);
#ifdef USE_TTS
ttsMan->popState();
#endif
#ifdef ENABLE_EVENTRECORDER #ifdef ENABLE_EVENTRECORDER
// Flush Event recorder file. The recorder does not get reinitialized for next game // Flush Event recorder file. The recorder does not get reinitialized for next game
// which is intentional. Only single game per session is allowed. // which is intentional. Only single game per session is allowed.

View file

@ -61,6 +61,10 @@
#include "graphics/pixelformat.h" #include "graphics/pixelformat.h"
#include "image/bmp.h" #include "image/bmp.h"
#ifdef USE_TTS
#include "common/text-to-speech.h"
#endif
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
extern bool isSmartphone(); extern bool isSmartphone();
#endif #endif
@ -515,6 +519,11 @@ void Engine::pauseEngineIntern(bool pause) {
void Engine::openMainMenuDialog() { void Engine::openMainMenuDialog() {
if (!_mainMenuDialog) if (!_mainMenuDialog)
_mainMenuDialog = new MainMenuDialog(this); _mainMenuDialog = new MainMenuDialog(this);
#ifdef USE_TTS
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->pushState();
GUI::GuiManager::initTextToSpeech();
#endif
setGameToLoadSlot(-1); setGameToLoadSlot(-1);
@ -536,6 +545,9 @@ void Engine::openMainMenuDialog() {
} }
syncSoundSettings(); syncSoundSettings();
#ifdef USE_TTS
ttsMan->popState();
#endif
} }
bool Engine::warnUserAboutUnsupportedGame() { bool Engine::warnUserAboutUnsupportedGame() {

View file

@ -107,6 +107,7 @@ public:
* only be deleted when that dialog is the top level dialog. * only be deleted when that dialog is the top level dialog.
*/ */
void addToTrash(GuiObject*, Dialog* parent = 0); void addToTrash(GuiObject*, Dialog* parent = 0);
static void initTextToSpeech();
bool _launched; bool _launched;
@ -177,7 +178,6 @@ protected:
void giveFocusToDialog(Dialog *dialog); void giveFocusToDialog(Dialog *dialog);
void setLastMousePos(int16 x, int16 y); void setLastMousePos(int16 x, int16 y);
void initTextToSpeech();
}; };
} // End of namespace GUI } // End of namespace GUI