aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-30 16:17:56 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commitbbbb608c528699f281fdd5a8a7d814dd44b9aa41 (patch)
treebd64682386ec79e1a8f3b00fe94885a52996e3cc /backends
parentf89ca9ad5c28731b5a95525eb220d43fca55d14b (diff)
downloadscummvm-rg350-bbbb608c528699f281fdd5a8a7d814dd44b9aa41.tar.gz
scummvm-rg350-bbbb608c528699f281fdd5a8a7d814dd44b9aa41.tar.bz2
scummvm-rg350-bbbb608c528699f281fdd5a8a7d814dd44b9aa41.zip
TTS: Implement OSD message reading
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp14
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp14
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 {