diff options
author | Jaromir Wysoglad | 2019-07-12 22:16:44 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | 8bd7e392657989dd49da592d8b0bf6e14fe50166 (patch) | |
tree | 83eaaabe11167533a7625fad3eaa76f7acdf01d0 /gui/options.cpp | |
parent | b5cebcbeaed5b1b860f2686379fc288c137a4c2f (diff) | |
download | scummvm-rg350-8bd7e392657989dd49da592d8b0bf6e14fe50166.tar.gz scummvm-rg350-8bd7e392657989dd49da592d8b0bf6e14fe50166.tar.bz2 scummvm-rg350-8bd7e392657989dd49da592d8b0bf6e14fe50166.zip |
TTS: Add voice selection to options
Diffstat (limited to 'gui/options.cpp')
-rw-r--r-- | gui/options.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
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) { |