| 17 | static ISpVoice* g_pVoice; |
| 18 | |
| 19 | void 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 | |
| 34 | void TextToSpeech::Deinitialize() |
| 35 | { |
nothing calls this directly
no test coverage detected