From b5d5576f90c177c54170a4e68b251c2fd5219260 Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Thu, 18 Jul 2019 23:53:52 +0200 Subject: TTS: Add check to getVoice, fix typo. Check if _availableVoices isn't empty. Replace availaible with available --- backends/text-to-speech/linux/linux-text-to-speech.cpp | 6 +++--- backends/text-to-speech/windows/windows-text-to-speech.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'backends/text-to-speech') 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 4b01b4478b..9abe805767 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.cpp +++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp @@ -184,8 +184,8 @@ bool LinuxTextToSpeechManager::isReady() { void LinuxTextToSpeechManager::setVoice(unsigned index) { if (_speechState == BROKEN) return; - assert(index < _ttsState->_availaibleVoices.size()); - Common::TTSVoice voice = _ttsState->_availaibleVoices[index]; + assert(index < _ttsState->_availableVoices.size()); + Common::TTSVoice voice = _ttsState->_availableVoices[index]; spd_set_voice_type(_connection, *(SPDVoiceType *)(voice.getData())); _ttsState->_activeVoice = index; } @@ -230,7 +230,7 @@ void LinuxTextToSpeechManager::createVoice(int typeNumber, Common::TTSVoice::Gen SPDVoiceType *type = (SPDVoiceType *) malloc(sizeof(SPDVoiceType)); *type = static_cast(typeNumber); Common::TTSVoice voice(gender, age, (void *) type, description); - _ttsState->_availaibleVoices.push_back(voice); + _ttsState->_availableVoices.push_back(voice); } void LinuxTextToSpeechManager::updateVoices() { 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 0625bc8d52..575c72b41f 100644 --- a/backends/text-to-speech/windows/windows-text-to-speech.cpp +++ b/backends/text-to-speech/windows/windows-text-to-speech.cpp @@ -79,7 +79,7 @@ void WindowsTextToSpeechManager::init() { _audio->SetFormat(format.FormatId(), format.WaveFormatExPtr()); _voice->SetOutput(_audio, FALSE); - if(_ttsState->_availaibleVoices.size() > 0) + if(_ttsState->_availableVoices.size() > 0) _speechState = READY; else _speechState = NO_VOICE; @@ -180,7 +180,7 @@ bool WindowsTextToSpeechManager::isReady() { void WindowsTextToSpeechManager::setVoice(unsigned index) { if(_speechState == BROKEN || _speechState == NO_VOICE) return; - _voice->SetVoice((ISpObjectToken *) _ttsState->_availaibleVoices[index].getData()); + _voice->SetVoice((ISpObjectToken *) _ttsState->_availableVoices[index].getData()); } void WindowsTextToSpeechManager::setRate(int rate) { @@ -211,11 +211,11 @@ int WindowsTextToSpeechManager::getVolume() { } void WindowsTextToSpeechManager::freeVoices() { - for(Common::TTSVoice *i = _ttsState->_availaibleVoices.begin(); i < _ttsState->_availaibleVoices.end(); i++) { + for(Common::TTSVoice *i = _ttsState->_availableVoices.begin(); i < _ttsState->_availableVoices.end(); i++) { ISpObjectToken *voiceData = (ISpObjectToken *)i->getData(); voiceData->Release(); } - _ttsState->_availaibleVoices.clear(); + _ttsState->_availableVoices.clear(); } void WindowsTextToSpeechManager::setLanguage(Common::String language) { @@ -290,7 +290,7 @@ void WindowsTextToSpeechManager::createVoice(void *cpVoiceToken) { free(buffer); CoTaskMemFree(data); - _ttsState->_availaibleVoices.push_back(Common::TTSVoice(gender, Common::TTSVoice::ADULT, (void *) voiceToken, desc)); + _ttsState->_availableVoices.push_back(Common::TTSVoice(gender, Common::TTSVoice::ADULT, (void *) voiceToken, desc)); } int strToInt(Common::String str) { @@ -340,9 +340,9 @@ void WindowsTextToSpeechManager::updateVoices() { _voice->SetVolume(_ttsState->_volume); cpEnum->Release(); - if(_ttsState->_availaibleVoices.size() == 0) { + if(_ttsState->_availableVoices.size() == 0) { _speechState = NO_VOICE; - warning("No voice is availaible"); + warning("No voice is available"); } else if (_speechState == NO_VOICE) _speechState = READY; } -- cgit v1.2.3