aboutsummaryrefslogtreecommitdiff
path: root/backends/text-to-speech
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-12 00:46:42 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commit62a011e28a4a7e253ad07319cef760566cba59cb (patch)
treee1e45440cbc2825adfb88097380c1c35dd1d68b0 /backends/text-to-speech
parent7f895d21df5ddb7c82a2f685d3a9fcc09b3d3a7a (diff)
downloadscummvm-rg350-62a011e28a4a7e253ad07319cef760566cba59cb.tar.gz
scummvm-rg350-62a011e28a4a7e253ad07319cef760566cba59cb.tar.bz2
scummvm-rg350-62a011e28a4a7e253ad07319cef760566cba59cb.zip
TTS: Add ttsStatus push and pop functions
Diffstat (limited to 'backends/text-to-speech')
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.cpp16
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.h2
2 files changed, 10 insertions, 8 deletions
diff --git a/backends/text-to-speech/linux/linux-text-to-speech.cpp b/backends/text-to-speech/linux/linux-text-to-speech.cpp
index 2586b16a2b..02ca5a8ef8 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.cpp
+++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp
@@ -82,8 +82,9 @@ LinuxTextToSpeechManager::LinuxTextToSpeechManager()
_connection->callback_pause = speech_pause_callback;
spd_set_notification_on(_connection, SPD_PAUSE);
- setLanguage(Common::String("cs"));
updateVoices();
+ _ttsState->_activeVoice = 0;
+ setLanguage(Common::String("en"));
}
LinuxTextToSpeechManager::~LinuxTextToSpeechManager() {
@@ -134,12 +135,14 @@ bool LinuxTextToSpeechManager::isReady() {
return _speechState == READY;
}
-void LinuxTextToSpeechManager::setVoice(Common::TTSVoice *voice) {
+void LinuxTextToSpeechManager::setVoice(unsigned index) {
if (_speechState == BROKEN)
return;
- assert(voice != nullptr && voice->getData() != nullptr);
- spd_set_voice_type(_connection, *(SPDVoiceType *)(voice->getData()));
- _ttsState->_activeVoice = voice;
+ debug("%d < %d", index, _ttsState->_availaibleVoices.size());
+ assert(index < _ttsState->_availaibleVoices.size());
+ Common::TTSVoice voice = _ttsState->_availaibleVoices[index];
+ spd_set_voice_type(_connection, *(SPDVoiceType *)(voice.getData()));
+ _ttsState->_activeVoice = index;
}
void LinuxTextToSpeechManager::setRate(int rate) {
@@ -171,8 +174,7 @@ void LinuxTextToSpeechManager::setLanguage(Common::String language) {
return;
spd_set_language(_connection, language.c_str());
_ttsState->_language = language;
- if (_ttsState->_activeVoice)
- setVoice(_ttsState->_activeVoice);
+ setVoice(_ttsState->_activeVoice);
}
void LinuxTextToSpeechManager::updateVoices() {
diff --git a/backends/text-to-speech/linux/linux-text-to-speech.h b/backends/text-to-speech/linux/linux-text-to-speech.h
index bb32979dd7..85f53eb2f8 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.h
+++ b/backends/text-to-speech/linux/linux-text-to-speech.h
@@ -52,7 +52,7 @@ public:
virtual bool isPaused();
virtual bool isReady();
- virtual void setVoice(Common::TTSVoice *voice);
+ virtual void setVoice(unsigned index);
virtual void setRate(int rate);