aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
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/graphics/surfacesdl/surfacesdl-graphics.cpp
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/graphics/surfacesdl/surfacesdl-graphics.cpp')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp14
1 files changed, 14 insertions, 0 deletions
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 {