aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-12 22:16:44 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commit8bd7e392657989dd49da592d8b0bf6e14fe50166 (patch)
tree83eaaabe11167533a7625fad3eaa76f7acdf01d0 /gui
parentb5cebcbeaed5b1b860f2686379fc288c137a4c2f (diff)
downloadscummvm-rg350-8bd7e392657989dd49da592d8b0bf6e14fe50166.tar.gz
scummvm-rg350-8bd7e392657989dd49da592d8b0bf6e14fe50166.tar.bz2
scummvm-rg350-8bd7e392657989dd49da592d8b0bf6e14fe50166.zip
TTS: Add voice selection to options
Diffstat (limited to 'gui')
-rw-r--r--gui/gui-manager.cpp15
-rw-r--r--gui/gui-manager.h2
-rw-r--r--gui/options.cpp17
-rw-r--r--gui/options.h1
-rw-r--r--gui/themes/default.inc3
5 files changed, 38 insertions, 0 deletions
diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp
index cff8e8c5cd..89d7d45b81 100644
--- a/gui/gui-manager.cpp
+++ b/gui/gui-manager.cpp
@@ -74,6 +74,10 @@ GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false),
TransMan.setLanguage(ConfMan.get("gui_language").c_str());
#endif // USE_TRANSLATION
+#ifdef USE_TTS
+ initTextToSpeech();
+#endif // USE_TTS
+
ConfMan.registerDefault("gui_theme", "scummremastered");
Common::String themefile(ConfMan.get("gui_theme"));
@@ -619,4 +623,15 @@ void GuiManager::setLastMousePos(int16 x, int16 y) {
_lastMousePosition.time = _system->getMillis(true);
}
+#ifdef USE_TTS
+void GuiManager::initTextToSpeech() {
+ int voice;
+ if(ConfMan.hasKey("tts_voice"))
+ voice = ConfMan.getInt("tts_voice", "scummvm");
+ else
+ voice = 0;
+ g_system->getTextToSpeechManager()->setVoice(voice);
+}
+#endif
+
} // End of namespace GUI
diff --git a/gui/gui-manager.h b/gui/gui-manager.h
index 07ea474628..fa5e715bcb 100644
--- a/gui/gui-manager.h
+++ b/gui/gui-manager.h
@@ -176,6 +176,8 @@ protected:
void giveFocusToDialog(Dialog *dialog);
void setLastMousePos(int16 x, int16 y);
+
+ void initTextToSpeech();
};
} // End of namespace GUI
diff --git a/gui/options.cpp b/gui/options.cpp
index 1d4f6c7e99..b871e92d11 100644
--- a/gui/options.cpp
+++ b/gui/options.cpp
@@ -39,6 +39,7 @@
#include "common/translation.h"
#include "common/updates.h"
#include "common/util.h"
+#include "common/text-to-speech.h"
#include "audio/mididrv.h"
#include "audio/musicplugin.h"
@@ -1527,6 +1528,7 @@ GlobalOptionsDialog::GlobalOptionsDialog(LauncherDialog *launcher)
#ifdef USE_TTS
_enableTTS = false;
_ttsCheckbox = 0;
+ _ttsVoiceSelectionPopUp = 0;
#endif
}
@@ -1797,6 +1799,18 @@ void GlobalOptionsDialog::build() {
else
_ttsCheckbox->setState(false);
+ _ttsVoiceSelectionPopUp = new PopUpWidget(tab, "GlobalOptions_Accessibility.TTSVoiceSelection");
+ Common::Array<Common::TTSVoice> voices = g_system->getTextToSpeechManager()->getVoicesArray();
+
+ for(unsigned i = 0; i < voices.size(); i++) {
+ _ttsVoiceSelectionPopUp->appendEntry(voices[i].getDescription(), i);
+ }
+
+ if (ConfMan.hasKey("tts_voice"))
+ _ttsVoiceSelectionPopUp->setSelectedTag(ConfMan.getInt("tts_voice", _domain)) ;
+ else
+ _ttsVoiceSelectionPopUp->setSelectedTag(0);
+
#endif // USE_TTS
// Activate the first tab
@@ -2136,6 +2150,9 @@ void GlobalOptionsDialog::apply() {
}
#ifdef USE_TTS
ConfMan.setBool("tts_enabled", _ttsCheckbox->getState(), _domain);
+ int selectedVoice = _ttsVoiceSelectionPopUp->getSelectedTag();
+ ConfMan.setInt("tts_voice", selectedVoice, _domain);
+ g_system->getTextToSpeechManager()->setVoice(selectedVoice);
#endif
if (isRebuildNeeded) {
diff --git a/gui/options.h b/gui/options.h
index 5f7a6b362f..76ad4ef082 100644
--- a/gui/options.h
+++ b/gui/options.h
@@ -361,6 +361,7 @@ protected:
#ifdef USE_TTS
bool _enableTTS;
CheckboxWidget *_ttsCheckbox;
+ PopUpWidget *_ttsVoiceSelectionPopUp;
#endif
};
diff --git a/gui/themes/default.inc b/gui/themes/default.inc
index 603567d700..2982bf22ce 100644
--- a/gui/themes/default.inc
+++ b/gui/themes/default.inc
@@ -1558,6 +1558,9 @@ const char *defaultXML1 = "<?xml version = '1.0'?>"
"<widget name='TTSCheckbox' "
"type='Checkbox' "
"/>"
+"<widget name='TTSVoiceSelection' "
+"type='PopUp' "
+"/>"
"</layout>"
"</dialog>"
"<dialog name='GlobalMenu' overlays='screen_center'>"