C++ : How to use SAPI with QT Creator? -
i've got project consist create web browser including text speech solution. i've used examples msdn (here), when try compile project, i've got lot of errors, , haven't found solutions...
i'm using qt creator project.
this project.pro :
#------------------------------------------------- # # project created qtcreator 2015-06-18t15:14:25 # #------------------------------------------------- qt += widgets webkitwidgets network multimedia target = project template = app sources += main.cpp \ browser.cpp headers += \ browser.h unix|win32: libs += -lsapi
and main.cpp :
#include <sapi.h> #include "sphelper.h" int main(int argc, char *argv[]) { ispvoice *pvoice; pvoice = null; hresult hr = spcreatebestobject(spcat_voices, l”gender=female”, null, &pvoice); // --> tried hresult hr = cocreateinstance(clsid_spvoice, null, clsctx_all, iid_ispvoice, (void **)&pvoice);, that's same result... if( succeeded( hr ) ) { hr = pvoice->speak(l"hello world", 0, null); pvoice->release(); pvoice = null; } return 0; }
thank's help!
this simplistic example can think of work msvc. don't imagine more different qt creator.
#include <sapi.h> #include <sphelper.h> #include <conio.h> int main(int argc, char *argv[]){ hresult hr = s_ok; ccomptr<ispvoice> cpvoice; ::coinitialize(null); hr = cpvoice.cocreateinstance(clsid_spvoice); if(succeeded(hr)){ cpvoice->speak(l"this test phrase.", spf_default, null); cpvoice.release(); } puts("press key continue..."); getch(); }
this code grab default voice , start speaking. in windows 7 voice ms anna.
Comments
Post a Comment