summaryrefslogtreecommitdiff
path: root/plugins/WinterSpeak/src/SpeechApi51.cpp
diff options
context:
space:
mode:
authorGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:03:31 +0100
committerGoraf <22941576+Goraf@users.noreply.github.com>2017-11-13 15:07:33 +0100
commita7c24ca48995cf2bf436156302f96b91bf135409 (patch)
tree953835509ff1b778833e78fd7b74b05e05e77c84 /plugins/WinterSpeak/src/SpeechApi51.cpp
parent591ec17b1c99db7f120c22ca9fb20ae05fe78325 (diff)
Code modernize ...
* replace 0/NULL with nullptr [using clang-tidy]
Diffstat (limited to 'plugins/WinterSpeak/src/SpeechApi51.cpp')
-rw-r--r--plugins/WinterSpeak/src/SpeechApi51.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/plugins/WinterSpeak/src/SpeechApi51.cpp b/plugins/WinterSpeak/src/SpeechApi51.cpp
index a674f80b35..d87ea33a53 100644
--- a/plugins/WinterSpeak/src/SpeechApi51.cpp
+++ b/plugins/WinterSpeak/src/SpeechApi51.cpp
@@ -29,7 +29,7 @@ namespace
}
//------------------------------------------------------------------------------
-SpeechApi51::SpeechApi51() : m_sapi(0), m_state(TextToSpeech::State_Unloaded), m_voice(L""), m_volume(50), m_pitch(50), m_rate(50)
+SpeechApi51::SpeechApi51() : m_sapi(nullptr), m_state(TextToSpeech::State_Unloaded), m_voice(L""), m_volume(50), m_pitch(50), m_rate(50)
{
}
@@ -44,12 +44,12 @@ SpeechApi51::~SpeechApi51()
//------------------------------------------------------------------------------
bool SpeechApi51::isAvailable()
{
- CoInitialize(NULL);
+ CoInitialize(nullptr);
ISpVoice *sapi;
bool ret = true;
- if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&sapi))))
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&sapi))))
{
ret = false;
}
@@ -69,9 +69,9 @@ bool SpeechApi51::load()
return true;
}
- CoInitialize(NULL);
+ CoInitialize(nullptr);
- if (FAILED(CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&m_sapi))))
+ if (FAILED(CoCreateInstance(CLSID_SpVoice, nullptr, CLSCTX_ALL, IID_ISpVoice, reinterpret_cast<void **>(&m_sapi))))
{
return false;
}
@@ -92,7 +92,7 @@ bool SpeechApi51::unload()
if (isLoaded())
{
m_sapi->Release();
- m_sapi = 0;
+ m_sapi = nullptr;
}
m_state = TextToSpeech::State_Unloaded;
@@ -123,7 +123,7 @@ bool SpeechApi51::say(const std::wstring &sentence)
//mbstowcs(sapi_sentence.get(), output.str().c_str(), output.str().size() + 1);
// speak the sentence
- if (FAILED(m_sapi->Speak(p, SPF_IS_XML | SPF_ASYNC, NULL)))
+ if (FAILED(m_sapi->Speak(p, SPF_IS_XML | SPF_ASYNC, nullptr)))
{
return false;
}
@@ -178,14 +178,14 @@ bool SpeechApi51::setVoice(const std::wstring &voice)
// get a voice enumerator
CComPtr<IEnumSpObjectTokens> cpEnum;
- if (FAILED(SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum)))
+ if (FAILED(SpEnumTokens(SPCAT_VOICES, nullptr, nullptr, &cpEnum)))
{
return false;
}
// iterate through the list till we find a matching voice
ISpObjectToken *voice_token;
- while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ while (S_OK == cpEnum->Next(1, &voice_token, nullptr))
{
CSpDynamicString voice_str;
@@ -205,18 +205,18 @@ std::vector<std::wstring> SpeechApi51::getVoices() const
{
std::vector<std::wstring> ret;
- CoInitialize(NULL);
+ CoInitialize(nullptr);
// get a voice enumerator
CComPtr<IEnumSpObjectTokens> cpEnum;
- if (S_OK != SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum))
+ if (S_OK != SpEnumTokens(SPCAT_VOICES, nullptr, nullptr, &cpEnum))
{
return ret;
}
// iterate through the voices and add them to the string vector
ISpObjectToken *voice_token;
- while (S_OK == cpEnum->Next(1, &voice_token, NULL))
+ while (S_OK == cpEnum->Next(1, &voice_token, nullptr))
{
CSpDynamicString voice_str;