diff options
author | Jaromir Wysoglad | 2019-07-12 00:46:42 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | 62a011e28a4a7e253ad07319cef760566cba59cb (patch) | |
tree | e1e45440cbc2825adfb88097380c1c35dd1d68b0 /backends | |
parent | 7f895d21df5ddb7c82a2f685d3a9fcc09b3d3a7a (diff) | |
download | scummvm-rg350-62a011e28a4a7e253ad07319cef760566cba59cb.tar.gz scummvm-rg350-62a011e28a4a7e253ad07319cef760566cba59cb.tar.bz2 scummvm-rg350-62a011e28a4a7e253ad07319cef760566cba59cb.zip |
TTS: Add ttsStatus push and pop functions
Diffstat (limited to 'backends')
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.cpp | 16 | ||||
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.h | 2 |
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); |