aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.cpp6
-rw-r--r--backends/text-to-speech/windows/windows-text-to-speech.cpp14
-rw-r--r--common/text-to-speech.cpp6
-rw-r--r--common/text-to-speech.h12
4 files changed, 22 insertions, 16 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 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<SPDVoiceType>(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;
}
diff --git a/common/text-to-speech.cpp b/common/text-to-speech.cpp
index 9ff8d50641..5bdf05e4dc 100644
--- a/common/text-to-speech.cpp
+++ b/common/text-to-speech.cpp
@@ -126,5 +126,11 @@ bool TextToSpeechManager::popState() {
return false;
}
+TTSVoice TextToSpeechManager::getVoice() {
+ if (!_ttsState->_availableVoices.empty())
+ return _ttsState->_availableVoices[_ttsState->_activeVoice];
+ return TTSVoice();
+}
+
}
#endif
diff --git a/common/text-to-speech.h b/common/text-to-speech.h
index 63b18395dc..012a1e2e25 100644
--- a/common/text-to-speech.h
+++ b/common/text-to-speech.h
@@ -110,7 +110,7 @@ class TTSVoice {
/**
* Returns the voice description. This description is really tts engine
- * specific and might be not be availaible with some tts engines.
+ * specific and might be not be available with some tts engines.
*/
String getDescription() { return _description; };
@@ -128,7 +128,7 @@ struct TTSState {
int _volume;
String _language;
int _activeVoice;
- Array<TTSVoice> _availaibleVoices;
+ Array<TTSVoice> _availableVoices;
TTSState *_next;
};
@@ -185,14 +185,14 @@ public:
/**
* Sets a voice to be used by the TTS.
*
- * @param index The index of the voice inside the _ttsState->_availaibleVoices array
+ * @param index The index of the voice inside the _ttsState->_availableVoices array
*/
virtual void setVoice(unsigned index) {}
/**
* Returns the voice, that is used right now
*/
- TTSVoice getVoice() { return _ttsState->_availaibleVoices[_ttsState->_activeVoice]; }
+ TTSVoice getVoice();
/**
* Sets the speech rate
@@ -247,9 +247,9 @@ public:
String getLanguage() { return _ttsState->_language; }
/**
- * Returns array of availaible voices for the current language
+ * Returns array of available voices for the current language
*/
- Array<TTSVoice> getVoicesArray() { return _ttsState->_availaibleVoices; }
+ Array<TTSVoice> getVoicesArray() { return _ttsState->_availableVoices; }
/**
* Pushes the current state of the TTS