M
MyCatAlex
Guest
I need a TSP (Text to Speech) function. It is so simple done in C#, here I ran into a problem. I found a C++ routine but it is presented as a main, so I am mutilating it. I am not sure it will work, and will appreciate any corrections.
bool TSP (string message) ???
{
ISpVoice* pVoice = NULL;
if (FAILED:CoInitialize(NULL)))
return FALSE;
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL,
CLSCTX_ALL, IID_ISpVoice, (void**)&pVoice);
if (SUCCEEDED(hr))
{
hr = pVoice->Speak(L"Hello world", 0, NULL); // I don't need Hello world, I need my message here.
pVoice->Release();
pVoice = NULL;
}
::CoUninitialize();
return TRUE;
}
I need it in a form that I could call this function from any place in my application.
Thank you, - MyCatAlex
Continue reading...
bool TSP (string message) ???
{
ISpVoice* pVoice = NULL;
if (FAILED:CoInitialize(NULL)))
return FALSE;
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL,
CLSCTX_ALL, IID_ISpVoice, (void**)&pVoice);
if (SUCCEEDED(hr))
{
hr = pVoice->Speak(L"Hello world", 0, NULL); // I don't need Hello world, I need my message here.
pVoice->Release();
pVoice = NULL;
}
::CoUninitialize();
return TRUE;
}
I need it in a form that I could call this function from any place in my application.
Thank you, - MyCatAlex
Continue reading...