c++ - SAPI: Application is not speaking -


please have @ following code

main.cpp

    #define _atl_apartment_threaded  #include <atlbase.h> //you may derive class ccommodule , use if want override something, //but not change name of _module extern ccommodule _module; #include <atlcom.h>  #include <sapi.h> #include <iostream>  using namespace std;  int main(int argc, char* argv[]) {     cout << "hello" << endl;     ispvoice * pvoice = null;      if (failed(::coinitialize(null)))         return false;      hresult hr = cocreateinstance(clsid_spvoice, null, clsctx_all, iid_ispvoice, (void **)&pvoice);     if( succeeded( hr ) )     {         cout << "succeeded" << endl;         hr = pvoice->speak(l"hello world", 0, null);         pvoice->release();         pvoice = null;     }     else     {         cout << "not succeeded" << endl;     }      ::couninitialize();     return true; } 

when run code, window opens, prints "hello" message. no sound coming out! supposed speak "hello world" ! why this?

following qt .pro settings in case required

following qt .pro settings

#------------------------------------------------- # # project created qtcreator 2013-05-03t14:31:00 # #-------------------------------------------------  qt       += core  qt       -= gui  target = speech config   += console config   -= app_bundle  template = app   sources += main.cpp  includepath += "c:/program files/microsoft speech sdk 5.1/bin" includepath += "c:/program files/microsoft speech sdk 5.1/include"    libs += "c:/program files/microsoft speech sdk 5.1/lib/i386/sapi.lib" libs += "c:/program files/microsoft sdks/windows/v7.0a/lib/user32.lib" 

please help!

you're calling release on pvoice object before speech has had time finish. api has waituntildone function, needed before releasing object.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -