diff options
Diffstat (limited to 'backends/text-to-speech')
3 files changed, 25 insertions, 12 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 1e92742845..758996dad8 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.cpp +++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp @@ -199,10 +199,10 @@ void LinuxTextToSpeechManager::setLanguage(Common::String language) { setVoice(_ttsState->_activeVoice); } -void LinuxTextToSpeechManager::createVoice(int typeNumber, Common::TTSVoice::Gender gender, char *description) { +void LinuxTextToSpeechManager::createVoice(int typeNumber, Common::TTSVoice::Gender gender, Common::TTSVoice::Age age, char *description) { SPDVoiceType *type = (SPDVoiceType *) malloc(sizeof(SPDVoiceType)); *type = static_cast<SPDVoiceType>(typeNumber); - _ttsState->_availaibleVoices.push_back(Common::TTSVoice(gender, (void *) type, description)); + _ttsState->_availaibleVoices.push_back(Common::TTSVoice(gender, age, (void *) type, description)); } void LinuxTextToSpeechManager::updateVoices() { @@ -219,14 +219,14 @@ void LinuxTextToSpeechManager::updateVoices() { char **voiceInfo = spd_list_voices(_connection); - createVoice(SPD_MALE1, Common::TTSVoice::MALE, voiceInfo[0]); - createVoice(SPD_MALE2, Common::TTSVoice::MALE, voiceInfo[1]); - createVoice(SPD_MALE3, Common::TTSVoice::MALE, voiceInfo[2]); - createVoice(SPD_FEMALE1, Common::TTSVoice::FEMALE, voiceInfo[3]); - createVoice(SPD_FEMALE2, Common::TTSVoice::FEMALE, voiceInfo[4]); - createVoice(SPD_FEMALE3, Common::TTSVoice::FEMALE, voiceInfo[5]); - createVoice(SPD_CHILD_MALE, Common::TTSVoice::MALE, voiceInfo[6]); - createVoice(SPD_CHILD_FEMALE, Common::TTSVoice::FEMALE, voiceInfo[7]); + createVoice(SPD_MALE1, Common::TTSVoice::MALE, Common::TTSVoice::ADULT, voiceInfo[0]); + createVoice(SPD_MALE2, Common::TTSVoice::MALE, Common::TTSVoice::ADULT, voiceInfo[1]); + createVoice(SPD_MALE3, Common::TTSVoice::MALE, Common::TTSVoice::ADULT, voiceInfo[2]); + createVoice(SPD_FEMALE1, Common::TTSVoice::FEMALE, Common::TTSVoice::ADULT, voiceInfo[3]); + createVoice(SPD_FEMALE2, Common::TTSVoice::FEMALE, Common::TTSVoice::ADULT, voiceInfo[4]); + createVoice(SPD_FEMALE3, Common::TTSVoice::FEMALE, Common::TTSVoice::ADULT, voiceInfo[5]); + createVoice(SPD_CHILD_MALE, Common::TTSVoice::MALE, Common::TTSVoice::CHILD, voiceInfo[6]); + createVoice(SPD_CHILD_FEMALE, Common::TTSVoice::FEMALE, Common::TTSVoice::CHILD, voiceInfo[7]); } 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 cd3fcf6cb3..64c2371b72 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.h +++ b/backends/text-to-speech/linux/linux-text-to-speech.h @@ -70,7 +70,7 @@ public: private: void init(); virtual void updateVoices(); - void createVoice(int typeNumber, Common::TTSVoice::Gender, char *description); + void createVoice(int typeNumber, Common::TTSVoice::Gender, Common::TTSVoice::Age, char *description); SpeechState _speechState; }; diff --git a/backends/text-to-speech/windows/windows-text-to-speech.cpp b/backends/text-to-speech/windows/windows-text-to-speech.cpp index edadf5e667..6f621ed5d6 100644 --- a/backends/text-to-speech/windows/windows-text-to-speech.cpp +++ b/backends/text-to-speech/windows/windows-text-to-speech.cpp @@ -49,6 +49,7 @@ ISpAudio *_audio; WindowsTextToSpeechManager::WindowsTextToSpeechManager() : _speechState(BROKEN){ + ConfMan.setInt("tts_voice", 0); init(); } @@ -268,7 +269,19 @@ void WindowsTextToSpeechManager::createVoice(void *cpVoiceToken) { free(buffer); CoTaskMemFree(data); - _ttsState->_availaibleVoices.push_back(Common::TTSVoice(gender, (void *) voiceToken, desc)); + // age + hr = key->GetStringValue(L"Age", &data); + if (FAILED(hr)) { + voiceToken->Release(); + warning("Could not get the age attribute for voice: %s", desc.c_str()); + return; + } + buffer = Win32::unicodeToAnsi(data); + Common::TTSVoice::Age age = !strcmp(buffer, "Adult") ? Common::TTSVoice::ADULT : Common::TTSVoice::UNKNOWN_AGE; + free(buffer); + CoTaskMemFree(data); + + _ttsState->_availaibleVoices.push_back(Common::TTSVoice(gender, Common::TTSVoice::ADULT, (void *) voiceToken, desc)); } int strToInt(Common::String str) { |