diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/text-to-speech.cpp | 18 | ||||
| -rw-r--r-- | common/text-to-speech.h | 3 |
2 files changed, 11 insertions, 10 deletions
diff --git a/common/text-to-speech.cpp b/common/text-to-speech.cpp index fa74e53c36..8e4742b3e9 100644 --- a/common/text-to-speech.cpp +++ b/common/text-to-speech.cpp @@ -88,15 +88,6 @@ TextToSpeechManager::TextToSpeechManager() { _ttsState->_next = nullptr; } -TextToSpeechManager::~TextToSpeechManager() { - TTSState *tmp = _ttsState; - while (tmp != nullptr) { - tmp = _ttsState->_next; - delete _ttsState; - _ttsState = tmp; - } -} - void TextToSpeechManager::pushState() { stop(); TTSState *newState = new TTSState; @@ -130,6 +121,15 @@ bool TextToSpeechManager::popState() { return false; } +void TextToSpeechManager::clearState() { + TTSState *tmp = _ttsState; + while (tmp != nullptr) { + tmp = _ttsState->_next; + delete _ttsState; + _ttsState = tmp; + } +} + TTSVoice TextToSpeechManager::getVoice() { if (!_ttsState->_availableVoices.empty()) return _ttsState->_availableVoices[_ttsState->_activeVoice]; diff --git a/common/text-to-speech.h b/common/text-to-speech.h index 14cbab17a5..cd34c28747 100644 --- a/common/text-to-speech.h +++ b/common/text-to-speech.h @@ -149,7 +149,7 @@ public: * pitch and volume to their middle values. */ TextToSpeechManager(); - virtual ~TextToSpeechManager(); + virtual ~TextToSpeechManager() {} /** * Interrupts what's being said and says the given string @@ -311,6 +311,7 @@ public: protected: TTSState *_ttsState; + void clearState(); virtual void updateVoices() {}; }; |
