aboutsummaryrefslogtreecommitdiff
path: root/backends/text-to-speech
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-08-15 13:24:01 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commitc402666635b17e6a4b4603f7cfa48d6755e2bfef (patch)
treefc2515c88d10a08dfc68889e57b5f19aed603ce0 /backends/text-to-speech
parent07acdb84336380b6de1cf72a27116b3b60ee3599 (diff)
downloadscummvm-rg350-c402666635b17e6a4b4603f7cfa48d6755e2bfef.tar.gz
scummvm-rg350-c402666635b17e6a4b4603f7cfa48d6755e2bfef.tar.bz2
scummvm-rg350-c402666635b17e6a4b4603f7cfa48d6755e2bfef.zip
TTS: Refactoring
Refactoring as suggested by bluegr on github.
Diffstat (limited to 'backends/text-to-speech')
-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.cpp8
2 files changed, 7 insertions, 7 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 bad45e8e88..eb864eb60e 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.cpp
+++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp
@@ -76,7 +76,7 @@ void *LinuxTextToSpeechManager::startSpeech(void *p) {
pthread_mutex_unlock(params->mutex);
return NULL;
}
- if(spd_say(_connection, SPD_MESSAGE, params->speechQueue->front().c_str()) == -1) {
+ if (spd_say(_connection, SPD_MESSAGE, params->speechQueue->front().c_str()) == -1) {
// close the connection
if (_connection != 0) {
spd_close(_connection);
@@ -141,7 +141,7 @@ void LinuxTextToSpeechManager::updateState(LinuxTextToSpeechManager::SpeechEvent
case SPEECH_ENDED:
pthread_mutex_lock(&_speechMutex);
_speechQueue.pop_front();
- if (_speechQueue.size() == 0)
+ if (_speechQueue.empty())
_speechState = READY;
else {
// reinitialize if needed
@@ -286,7 +286,7 @@ bool LinuxTextToSpeechManager::resume() {
_threadCreated = false;
}
_speechState = PAUSED;
- if (_speechQueue.size()) {
+ if (!_speechQueue.empty()) {
_speechState = SPEAKING;
startSpeech((void *) &_params);
}
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)