Hey guys~ i’m using Microsoft speech sdk 5.1. it contains two parts: text to speech and speech recognition. attached is a simple example of text to speech. Follow below steps:
1)download and install MS speech sdk 5.1
2)create a new win32 console applicaton using VC6.
3)set the SAPI.h path
Click the C/C++ tab and select Preprocessor from the Category drop-down list. Enter the following in the “Additional include directories”: C:\Program Files\Microsoft Speech SDK 5.1\Include.
4)set the SAPI.lib path
Select the Link tab from the Same Settings dialog box.
Choose Input from the Category drop-down list.
Add the following path to the “Additional library path”:
C:\Program Files\Microsoft Speech SDK 5.1\Lib\i386.
Also add “sapi.lib” to the “Object/library modules” line. Be sure that the name is separated by a space
5)create a new cpp file and copy the attached file’s codes
but when i try to add this code to an emptyExample of OF0.06. i encounter lots of errors like:
c:\program files\microsoft speech sdk 5.1\include\spdebug.h(292) : error C3861: ‘CreateMutex’: identifier not found
1>c:\program files\microsoft speech sdk 5.1\include\spdebug.h(300) : error C3861: ‘CreateFile’: identifier not found
1>d:\program files\microsoft visual studio 9.0\vc\atlmfc\include\atlcore.h(308) : error C2039: ‘FindResource’ : is not a member of ‘`global namespace’’
could anybody help to change this to a simple OF based text to speech?
thanks in advance
#include <sapi.h>
#include <sphelper.h>
int main(int argc, char* argv[])
{
ISpVoice * pVoice = NULL;
ISpObjectToken * cpVoiceToken;
IEnumSpObjectTokens * cpEnum;
if (FAILED(::CoInitialize(NULL)))
return FALSE;
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
//set different voice
hr = SpEnumTokens(SPCAT_VOICES, NULL, NULL, &cpEnum);
hr = cpEnum->Item( 1, &cpVoiceToken);
hr = pVoice->SetVoice(cpVoiceToken);
//now let's speak
hr = pVoice->Speak(L"Hello", 0, NULL);
cpVoiceToken->Release();
pVoice->Release();
pVoice = NULL;
}
::CoUninitialize();