aboutsummaryrefslogtreecommitdiff
path: root/backends/text-to-speech/linux
diff options
context:
space:
mode:
Diffstat (limited to 'backends/text-to-speech/linux')
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.cpp11
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.h2
2 files changed, 8 insertions, 5 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 633c107727..db036e053a 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.cpp
+++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp
@@ -206,7 +206,8 @@ void LinuxTextToSpeechManager::setLanguage(Common::String language) {
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, age, (void *) type, description));
+ Common::TTSVoice voice(gender, age, (void *) type, description);
+ _ttsState->_availaibleVoices.push_back(voice);
}
void LinuxTextToSpeechManager::updateVoices() {
@@ -238,10 +239,6 @@ bool LinuxTextToSpeechManager::popState() {
if (_ttsState->_next == nullptr)
return true;
- for (Common::TTSVoice *i = _ttsState->_availaibleVoices.begin(); i < _ttsState->_availaibleVoices.end(); i++) {
- free(i->getData());
- }
-
Common::TTSState *oldState = _ttsState;
_ttsState = _ttsState->_next;
@@ -254,5 +251,9 @@ bool LinuxTextToSpeechManager::popState() {
return false;
}
+void LinuxTextToSpeechManager::freeVoiceData(void *data) {
+ free(data);
+}
+
#endif
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 64c2371b72..57b9aeea60 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.h
+++ b/backends/text-to-speech/linux/linux-text-to-speech.h
@@ -67,6 +67,8 @@ public:
void updateState(SpeechState state);
+ virtual void freeVoiceData(void *data);
+
private:
void init();
virtual void updateVoices();