MCPcopy Create free account
hub / github.com/DiscordMessenger/dm / Initialize

Method Initialize

src/windows/TextToSpeech.cpp:19–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17static ISpVoice* g_pVoice;
18
19void TextToSpeech::Initialize()
20{
21 HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void**)&g_pVoice);
22
23 if (!SUCCEEDED(hr))
24 {
25 std::string xstr = TmGetString(IDS_FAILED_TO_INITIALIZE_SAPI) + "\n\n(" + std::to_string((long)hr) + ") " + GetStringFromHResult(hr);
26 LPCTSTR tstr1 = ConvertCppStringToTString(xstr);
27 MessageBox(g_Hwnd, tstr1, TmGetTString(IDS_FAILED_TO_INITIALIZE_SAPI_TITLE), MB_OK | MB_ICONERROR);
28 free((void*)tstr1);
29 // TODO: Let the user know that there is no text to speech.
30 return;
31 }
32}
33
34void TextToSpeech::Deinitialize()
35{

Callers

nothing calls this directly

Calls 3

GetStringFromHResultFunction · 0.85
to_stringFunction · 0.50

Tested by

no test coverage detected