From c402666635b17e6a4b4603f7cfa48d6755e2bfef Mon Sep 17 00:00:00 2001 From: Jaromir Wysoglad Date: Thu, 15 Aug 2019 13:24:01 +0200 Subject: TTS: Refactoring Refactoring as suggested by bluegr on github. --- backends/text-to-speech/windows/windows-text-to-speech.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'backends/text-to-speech/windows/windows-text-to-speech.cpp') 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 c4de02d243..3ef4b55b74 100644 --- a/backends/text-to-speech/windows/windows-text-to-speech.cpp +++ b/backends/text-to-speech/windows/windows-text-to-speech.cpp @@ -80,7 +80,7 @@ void WindowsTextToSpeechManager::init() { // init voice hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&_voice); - if (!SUCCEEDED(hr)) { + if (FAILED(hr)) { warning("Could not initialize TTS voice"); return; } @@ -93,7 +93,7 @@ void WindowsTextToSpeechManager::init() { _voice->SetOutput(_audio, FALSE); - if (_ttsState->_availableVoices.size() > 0) + if (!_ttsState->_availableVoices.empty()) _speechState = READY; else _speechState = NO_VOICE; @@ -156,7 +156,7 @@ DWORD WINAPI startSpeech(LPVOID parameters) { bool WindowsTextToSpeechManager::say(Common::String str, Action action, Common::String charset) { if (_speechState == BROKEN || _speechState == NO_VOICE) { - warning("The tts cannot speak in this state"); + warning("The text to speech cannot speak in this state"); return true; } @@ -455,7 +455,7 @@ void WindowsTextToSpeechManager::updateVoices() { _voice->SetVolume(_ttsState->_volume); cpEnum->Release(); - if (_ttsState->_availableVoices.size() == 0) { + if (_ttsState->_availableVoices.empty()) { _speechState = NO_VOICE; warning("No voice is available"); } else if (_speechState == NO_VOICE) -- cgit v1.2.3