diff options
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 14 | ||||
-rw-r--r-- | backends/graphics/surfacesdl/surfacesdl-graphics.cpp | 14 |
2 files changed, 27 insertions, 1 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index a6f31e64fb..06a0109476 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -50,6 +50,10 @@ #include "image/bmp.h" #endif +#ifdef USE_TTS +#include "common/text-to-speech.h" +#endif + namespace OpenGL { OpenGLGraphicsManager::OpenGLGraphicsManager() @@ -780,7 +784,7 @@ void OpenGLGraphicsManager::displayMessageOnOSD(const char *msg) { _osdMessageChangeRequest = true; _osdMessageNextData = msg; -#endif +#endif // USE_OSD } #ifdef USE_OSD @@ -842,6 +846,14 @@ void OpenGLGraphicsManager::osdMessageUpdateSurface() { _osdMessageAlpha = kOSDMessageInitialAlpha; _osdMessageFadeStartTime = g_system->getMillis() + kOSDMessageFadeOutDelay; +#ifdef USE_TTS + if (ConfMan.hasKey("tts_enabled", "scummvm") && + ConfMan.getBool("tts_enabled", "scummvm")) { + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan) + ttsMan->say(_osdMessageNextData); + } +#endif // USE_TTS // Clear the text update request _osdMessageNextData.clear(); _osdMessageChangeRequest = false; diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp index 4b4f218caf..6434e5c295 100644 --- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp +++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp @@ -44,6 +44,9 @@ #include "common/file.h" #include "image/png.h" #endif +#ifdef USE_TTS +#include "common/text-to-speech.h" +#endif static const OSystem::GraphicsMode s_supportedShaders[] = { {"NONE", "Normal (no shader)", 0}, @@ -2303,6 +2306,9 @@ void SurfaceSdlGraphicsManager::drawMouse() { void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) { assert(_transactionMode == kTransactionNone); assert(msg); +#ifdef USE_TTS + Common::String textToSay = msg; +#endif // USE_TTS Common::StackLock lock(_graphicsMutex); // Lock the mutex until this function ends @@ -2376,6 +2382,14 @@ void SurfaceSdlGraphicsManager::displayMessageOnOSD(const char *msg) { // Ensure a full redraw takes place next time the screen is updated _forceRedraw = true; +#ifdef USE_TTS + if (ConfMan.hasKey("tts_enabled", "scummvm") && + ConfMan.getBool("tts_enabled", "scummvm")) { + Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager(); + if (ttsMan) + ttsMan->say(textToSay); + } +#endif // USE_TTS } SDL_Rect SurfaceSdlGraphicsManager::getOSDMessageRect() const { |