gorexy
asked on
Seech SDK 5.1 VC++ question
HI,
I am working with the Speech SDK TTS
I face an error when I want to change the token.
I add this
CComPtr<IEnumSpObjectToken s> cpEnum;
CComPtr<ISpObjectToken> cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES, L"Name=Microsoft Sam", NULL, &cpEnum);
}
//set the voice
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
}
it keeps saying 'CComPtr' : undeclared identifier
what;s wrong?
I tried to include #include <atlbase.h> but even worst, it shows over 100 errors.
I am working with the Speech SDK TTS
I face an error when I want to change the token.
I add this
CComPtr<IEnumSpObjectToken
CComPtr<ISpObjectToken> cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES,
}
//set the voice
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
}
it keeps saying 'CComPtr' : undeclared identifier
what;s wrong?
I tried to include #include <atlbase.h> but even worst, it shows over 100 errors.
ASKER
Hi thanks!
My code is as follows:
////////////////////////// ////////// ////////// ////////// ///////
#include "CKAll.h"
#include <sapi.h>
.....
int SpeakOut(const CKBehaviorContext& BehContext)
{
CKBehavior* beh = BehContext.Behavior;
CComPtr<ISpVoice> cpVoice;
beh->ActivateInput(0,FALSE );
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu e(0, sIP);
beh->SetOutputParameterVal ue(0,sIP);
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP , 0, sIP, -1, (LPWSTR)wsIP, 300);
////////////////////////// Text to Speech Start///////////////////// ////
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance(CLSID_SpV oice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP , 0, NULL);
pVoice->Release();
pVoice = NULL;
}
return CKBR_OK;
}
Do you mind to have a look and suggest me how to change it?
I will try your code also
Thanks
My code is as follows:
//////////////////////////
#include "CKAll.h"
#include <sapi.h>
.....
int SpeakOut(const CKBehaviorContext& BehContext)
{
CKBehavior* beh = BehContext.Behavior;
CComPtr<ISpVoice> cpVoice;
beh->ActivateInput(0,FALSE
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu
beh->SetOutputParameterVal
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP
//////////////////////////
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance(CLSID_SpV
if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP
pVoice->Release();
pVoice = NULL;
}
return CKBR_OK;
}
Do you mind to have a look and suggest me how to change it?
I will try your code also
Thanks
ASKER
Errors still
here is my code
////////////////////////// ////////// ////////// ////////// ///
typedef _com_ptr_t<_com_IIID<ISpOb jectToken, &__uuidof(ISpObjectToken)> > ISpObjectTokenPtr;
typedef _com_ptr_t<_com_IIID<IEnum SpObjectTo kens, &__uuidof(IEnumSpObjectTok ens)> > IEnumSpObjectTokensPtr;
typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoice cpVoice;
beh->ActivateInput(0,FALSE );
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu e(0, sIP);
//BehContext.Context->Outp utToConsol eEx("Set server ip to %s", sIP);
beh->SetOutputParameterVal ue(0,sIP);
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP , 0, sIP, -1, (LPWSTR)wsIP, 300);
////////////////////////// Text to Speech Start///////////////////// ////
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance(CLSID_SpV oice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES, L"Name=Microsoft Sam", NULL, &cpEnum);
}
//set the voice
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP , 0, NULL);
pVoice->Release();
pVoice = NULL;
}
sorry I am new in this kind of stuff
here is my code
//////////////////////////
typedef _com_ptr_t<_com_IIID<ISpOb
typedef _com_ptr_t<_com_IIID<IEnum
typedef _com_ptr_t<_com_IIID<ISpVo
beh->ActivateInput(0,FALSE
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu
//BehContext.Context->Outp
beh->SetOutputParameterVal
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP
//////////////////////////
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance(CLSID_SpV
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES,
}
//set the voice
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP
pVoice->Release();
pVoice = NULL;
}
sorry I am new in this kind of stuff
ASKER
ok now I try to use the link your provide
and one error only
SpEnumTokens': identifier not found, even with argument-dependent lookup
I search the SDK reference and the function found in #include <sphelper.h>
so I include #include <sphelper.h>
but fail
any suggestion?
and one error only
SpEnumTokens': identifier not found, even with argument-dependent lookup
I search the SDK reference and the function found in #include <sphelper.h>
so I include #include <sphelper.h>
but fail
any suggestion?
for sapi with _com_ptr_t you need:
#include <comip.h> // (comsupp.lib)
#include <sapi.h> //(sapi.lib)
#include <spuihelp.h>
can you post the errormessage please
#include <comip.h> // (comsupp.lib)
#include <sapi.h> //(sapi.lib)
#include <spuihelp.h>
can you post the errormessage please
ups, sorry, you already posted the error
ASKER
Compiling...
SpeakOut.cpp
c:\Text_Syn\Project1\Speak Out.cpp(96 ) : error C2371: 'cpEnum' : redefinition; different basic types
c:\Text_Syn\Project1\Speak Out.cpp(73 ) : see declaration of 'cpEnum'
c:\Text_Syn\Project1\Speak Out.cpp(97 ) : error C2371: 'cpToken' : redefinition; different basic types
c:\Text_Syn\Project1\Speak Out.cpp(74 ) : see declaration of 'cpToken'
c:\Text_Syn\Project1\Speak Out.cpp(10 1) : error C3861: 'cpEnum': identifier not found, even with argument-dependent lookup
c:\Text_Syn\Project1\Speak Out.cpp(10 6) : error C3861: 'cpToken': identifier not found, even with argument-dependent lookup
Project1 - 4 error(s), 0 warning(s)
SpeakOut.cpp
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
Project1 - 4 error(s), 0 warning(s)
>SpEnumTokens': identifier not found, even with argument-dependent lookup
are you sure spuihelp.h is included?
are you sure spuihelp.h is included?
typedef _com_ptr_t<_com_IIID<ISpOb jectToken, &__uuidof(ISpObjectToken)> > ISpObjectTokenPtr;
typedef _com_ptr_t<_com_IIID<IEnum SpObjectTo kens, &__uuidof(IEnumSpObjectTok ens)> > IEnumSpObjectTokensPtr;
typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoice VoicePtr;
beh->ActivateInput(0,FALSE );
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu e(0, sIP);
//BehContext.Context->Outp utToConsol eEx("Set server ip to %s", sIP);
beh->SetOutputParameterVal ue(0,sIP);
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP , 0, sIP, -1, (LPWSTR)wsIP, 300);
////////////////////////// Text to Speech Start///////////////////// ////
VoicePtr cpVoice;
HRESULT hr = cpVoice.CreateInstance(CLS ID_SpVoice );
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES, L"Name=Microsoft Sam", NULL, &cpEnum);
}
//set the voice
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI P , 0, NULL);
}
}
typedef _com_ptr_t<_com_IIID<IEnum
typedef _com_ptr_t<_com_IIID<ISpVo
beh->ActivateInput(0,FALSE
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu
//BehContext.Context->Outp
beh->SetOutputParameterVal
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP
//////////////////////////
VoicePtr cpVoice;
HRESULT hr = cpVoice.CreateInstance(CLS
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES,
}
//set the voice
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI
}
}
ASKER
that is ok
how to initilize cpVoice
typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoice cpVoice;
this is wrong
how to initilize cpVoice
typedef _com_ptr_t<_com_IIID<ISpVo
this is wrong
oh, before you can use cpToken, you have to init or load from enum!
cpEnum->->Item(0, &cpToken );
cpEnum->->Item(0, &cpToken );
>typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoice cpVoice;
well, this is ok, but its a typedef, this means if you write cpVoice would be the same as to write _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > like #define...
to declare a pointer just write cpVoice pVoice;
But you later used cpVoice directly, but it is a typefef, no variable.
To be more clrear i changed cpVoice to VoicePtr, like the other typedefs
well, this is ok, but its a typedef, this means if you write cpVoice would be the same as to write _com_ptr_t<_com_IIID<ISpVo
to declare a pointer just write cpVoice pVoice;
But you later used cpVoice directly, but it is a typefef, no variable.
To be more clrear i changed cpVoice to VoicePtr, like the other typedefs
cpEnum->->Item(0, &cpToken ); must be cpEnum->Item(0, &cpToken );
ASKER
i am still testing
once ok i will get back to you
BTW, where can I learn more ATL projecT? I feels confused still
Thanks
once ok i will get back to you
BTW, where can I learn more ATL projecT? I feels confused still
Thanks
i normally don't use ATL...
here you can find some examples:
http://www.codeguru.com/cpp/com-tech/atl/
here you can find some examples:
http://www.codeguru.com/cpp/com-tech/atl/
ASKER
I don't want to use too
but the SPEECH SDK uses that and we have to follow
I want to change the voice freely and so I need to get the token
The SDK example use ATL and so I follow
will let you know it works or not
Thanks for your help!!
but the SPEECH SDK uses that and we have to follow
I want to change the voice freely and so I need to get the token
The SDK example use ATL and so I follow
will let you know it works or not
Thanks for your help!!
im sorry, i forgot to metion:
there are two helpers for sapi, the sphelper.h wich requiers no atl and the spuihelp.h wich requires atl.
within sphelper.h there is also all defined you need like SpEnumTokens...
i thought you were using the sphelper.h, so im sorry for not telling you earlier
there are two helpers for sapi, the sphelper.h wich requiers no atl and the spuihelp.h wich requires atl.
within sphelper.h there is also all defined you need like SpEnumTokens...
i thought you were using the sphelper.h, so im sorry for not telling you earlier
The CComPtr than will also work when including sphelper.h
ASKER
HI the code still fails
////////////////////////// ////////// ////////// /////////
typedef _com_ptr_t<_com_IIID<ISpOb jectToken, &__uuidof(ISpObjectToken)> > ISpObjectTokenPtr;
typedef _com_ptr_t<_com_IIID<IEnum SpObjectTo kens, &__uuidof(IEnumSpObjectTok ens)> > IEnumSpObjectTokensPtr;
typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoice VoicePtr;
beh->ActivateInput(0,FALSE );
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu e(0, sIP);
//BehContext.Context->Outp utToConsol eEx("Set server ip to %s", sIP);
beh->SetOutputParameterVal ue(0,sIP);
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP , 0, sIP, -1, (LPWSTR)wsIP, 300);
////////////////////////// Text to Speech Start///////////////////// ////
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance(CLSID_SpV oice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
// ISpVoiceVoicePtr cpVoice;
VoicePtr cpVoice;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES, L"Name=MS Mary", NULL, &cpEnum);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP , 0, NULL);
pVoice->Release();
pVoice = NULL;
}
return CKBR_OK;
}
can you have a look?
error message
////////////////////////// //////////
c:\Text_Syn\Project1\Speak Out.cpp(79 ) : error C2065: 'VoicePtr' : undeclared identifier
c:\Text_Syn\Project1\Speak Out.cpp(10 1) : error C2146: syntax error : missing ';' before identifier 'cpVoice'
c:\Text_Syn\Project1\Speak Out.cpp(10 1) : error C3861: 'VoicePtr': identifier not found, even with argument-dependent lookup
c:\Text_Syn\Project1\Speak Out.cpp(10 1) : error C2065: 'cpVoice' : undeclared identifier
c:\Text_Syn\Project1\Speak Out.cpp(11 0) : error C2227: left of '->SetVoice' must point to class/struct/union
type is ''unknown-type''
c:\Text_Syn\Project1\Speak Out.cpp(11 0) : error C3861: 'cpVoice': identifier not found, even with argument-dependent lookup
c:\Text_Syn\Project1\Speak Out.cpp(11 5) : error C2039: 'Speak' : is not a member of '_com_ptr_t<_IIID>'
with
[
_IIID=_com_IIID<ISpVoice,& _GUID_6c44df74_72b9_4992_a 1ec_ef996e 0422d4>
]
Project1.cpp
MyManager.cpp
Generating Code...
//////////////////////////
typedef _com_ptr_t<_com_IIID<ISpOb
typedef _com_ptr_t<_com_IIID<IEnum
typedef _com_ptr_t<_com_IIID<ISpVo
beh->ActivateInput(0,FALSE
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu
//BehContext.Context->Outp
beh->SetOutputParameterVal
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP
//////////////////////////
ISpVoice * pVoice = NULL;
HRESULT hr = CoCreateInstance(CLSID_SpV
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
// ISpVoiceVoicePtr cpVoice;
VoicePtr cpVoice;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES,
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP
pVoice->Release();
pVoice = NULL;
}
return CKBR_OK;
}
can you have a look?
error message
//////////////////////////
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
type is ''unknown-type''
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
with
[
_IIID=_com_IIID<ISpVoice,&
]
Project1.cpp
MyManager.cpp
Generating Code...
ASKER
Pls ignore my previous message
here is teh lastest code
#include "CKAll.h"
#include <sapi.h>
#include <comip.h> // (comsupp.lib)
#include <spuihelp.h>
...
int SpeakOut(const CKBehaviorContext& BehContext)
{
CKBehavior* beh = BehContext.Behavior;
typedef _com_ptr_t<_com_IIID<ISpOb jectToken, &__uuidof(ISpObjectToken)> > ISpObjectTokenPtr;
typedef _com_ptr_t<_com_IIID<IEnum SpObjectTo kens, &__uuidof(IEnumSpObjectTok ens)> > IEnumSpObjectTokensPtr;
typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoice VoicePtr;
beh->ActivateInput(0,FALSE );
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu e(0, sIP);
beh->SetOutputParameterVal ue(0,sIP);
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP , 0, sIP, -1, (LPWSTR)wsIP, 300);
VoicePtr cpVoice;
////////////////////////// Text to Speech Start///////////////////// ////
HRESULT hr = cpVoice.CreateInstance(CLS ID_SpVoice );
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES, L"Name=MS Mary", NULL, &cpEnum);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI P , 0, NULL);
}
return CKBR_OK;
}
Error message
SpeakOut.cpp
c:\Text_Syn\Project1\Speak Out.cpp(79 ) : error C2146: syntax error : missing ';' before identifier 'VoicePtr'
c:\Text_Syn\Project1\Speak Out.cpp(79 ) : error C2065: 'VoicePtr' : undeclared identifier
c:\Text_Syn\Project1\Speak Out.cpp(94 ) : error C2146: syntax error : missing ';' before identifier 'cpVoice'
c:\Text_Syn\Project1\Speak Out.cpp(94 ) : error C3861: 'VoicePtr': identifier not found, even with argument-dependent lookup
c:\Text_Syn\Project1\Speak Out.cpp(94 ) : error C2065: 'cpVoice' : undeclared identifier
c:\Text_Syn\Project1\Speak Out.cpp(99 ) : error C2228: left of '.CreateInstance' must have class/struct/union type
type is ''unknown-type''
c:\Text_Syn\Project1\Speak Out.cpp(99 ) : error C3861: 'cpVoice': identifier not found, even with argument-dependent lookup
c:\Text_Syn\Project1\Speak Out.cpp(11 3) : error C2227: left of '->SetVoice' must point to class/struct/union
type is ''unknown-type''
c:\Text_Syn\Project1\Speak Out.cpp(11 3) : error C3861: 'cpVoice': identifier not found, even with argument-dependent lookup
c:\Text_Syn\Project1\Speak Out.cpp(12 6) : error C2227: left of '->SetOutput' must point to class/struct/union
type is ''unknown-type''
c:\Text_Syn\Project1\Speak Out.cpp(12 6) : error C3861: 'cpVoice': identifier not found, even with argument-dependent lookup
c:\Text_Syn\Project1\Speak Out.cpp(12 9) : error C2227: left of '->Speak' must point to class/struct/union
type is ''unknown-type''
c:\Text_Syn\Project1\Speak Out.cpp(12 9) : error C3861: 'cpVoice': identifier not found, even with argument-dependent lookup
Project1.cpp
MyManager.cpp
Generating Code...
here is teh lastest code
#include "CKAll.h"
#include <sapi.h>
#include <comip.h> // (comsupp.lib)
#include <spuihelp.h>
...
int SpeakOut(const CKBehaviorContext& BehContext)
{
CKBehavior* beh = BehContext.Behavior;
typedef _com_ptr_t<_com_IIID<ISpOb
typedef _com_ptr_t<_com_IIID<IEnum
typedef _com_ptr_t<_com_IIID<ISpVo
beh->ActivateInput(0,FALSE
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu
beh->SetOutputParameterVal
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP
VoicePtr cpVoice;
//////////////////////////
HRESULT hr = cpVoice.CreateInstance(CLS
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES,
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI
}
return CKBR_OK;
}
Error message
SpeakOut.cpp
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
type is ''unknown-type''
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
type is ''unknown-type''
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
type is ''unknown-type''
c:\Text_Syn\Project1\Speak
c:\Text_Syn\Project1\Speak
type is ''unknown-type''
c:\Text_Syn\Project1\Speak
Project1.cpp
MyManager.cpp
Generating Code...
ASKER
In fact, I found that we can program MS Agent and it supports many language
Is it possible for us to combine that agent in the Speech SDK in order to develop multi language application>?
Is it possible for us to combine that agent in the Speech SDK in order to develop multi language application>?
#include "CKAll.h"
#include <comip.h> // (comsupp.lib)
#include <sphelper.h> // use sphelper not spuihelp (sapi.h also included)
int SpeakOut(const CKBehaviorContext& BehContext)
{
CKBehavior* beh = BehContext.Behavior;
typedef _com_ptr_t<_com_IIID<ISpOb jectToken, &__uuidof(ISpObjectToken)> > ISpObjectTokenPtr;
typedef _com_ptr_t<_com_IIID<IEnum SpObjectTo kens, &__uuidof(IEnumSpObjectTok ens)> > IEnumSpObjectTokensPtr;
typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoicePtr; // sorry, this line still wasn't correct.
beh->ActivateInput(0,FALSE );
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu e(0, sIP);
beh->SetOutputParameterVal ue(0,sIP);
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP , 0, sIP, -1, (LPWSTR)wsIP, 300);
ISpVoicePtr cpVoice;
////////////////////////// Text to Speech Start///////////////////// ////
HRESULT hr = cpVoice.CreateInstance(CLS ID_SpVoice );
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES, L"Name=Microsoft Mary", NULL, &cpEnum); // MS Mary was not found by my system
}
// cpToken is still empty, first load token from cpEnum
if(SUCCEEDED(hr))
{
hr = cpEnum->Item(0, &cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice(cpToken) ;
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI P , 0, NULL);
}
return CKBR_OK;
}
hi, compiled this code without CKBehaviorContext and its working on my machine...
#include <comip.h> // (comsupp.lib)
#include <sphelper.h> // use sphelper not spuihelp (sapi.h also included)
int SpeakOut(const CKBehaviorContext& BehContext)
{
CKBehavior* beh = BehContext.Behavior;
typedef _com_ptr_t<_com_IIID<ISpOb
typedef _com_ptr_t<_com_IIID<IEnum
typedef _com_ptr_t<_com_IIID<ISpVo
beh->ActivateInput(0,FALSE
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu
beh->SetOutputParameterVal
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP
ISpVoicePtr cpVoice;
//////////////////////////
HRESULT hr = cpVoice.CreateInstance(CLS
IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
if(SUCCEEDED(hr))
{
hr = SpEnumTokens(SPCAT_VOICES,
}
// cpToken is still empty, first load token from cpEnum
if(SUCCEEDED(hr))
{
hr = cpEnum->Item(0, &cpToken);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice(cpToken)
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
} if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI
}
return CKBR_OK;
}
hi, compiled this code without CKBehaviorContext and its working on my machine...
ASKER
i got this
unresolved external symbol "void __stdcall _com_issue_error(long)"
unresolved external symbol "void __stdcall _com_issue_error(long)"
ASKER
then I wrote
//Alex Added Here
CKBehavior* beh = BehContext.Behavior;
/* CComPtr<ISpVoice> cpVoice;
CComPtr<IEnumSpObjectToken s> cpEnum;
CComPtr<ISpObjectToken> cpToken;*/
CComPtr<ISpVoice> cpVoice;
CComPtr<IEnumSpObjectToken s> cpEnum;
//typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoiceVoicePtr;
typedef _com_ptr_t<_com_IIID<ISpOb jectToken, &__uuidof(ISpObjectToken)> > ISpObjectTokenPtr;
//typedef _com_ptr_t<_com_IIID<IEnum SpObjectTo kens, &__uuidof(IEnumSpObjectTok ens)> > IEnumSpObjectTokensPtr;
//typedef _com_ptr_t<_com_IIID<ISpVo ice, &__uuidof(ISpVoice)> > ISpVoicePtr;
beh->ActivateInput(0,FALSE );
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu e(0, sIP);
//BehContext.Context->Outp utToConsol eEx("Set server ip to %s", sIP);
beh->SetOutputParameterVal ue(0,sIP);
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP , 0, sIP, -1, (LPWSTR)wsIP, 300);
//ISpVoiceVoicePtr cpVoice;
////////////////////////// Text to Speech Start///////////////////// ////
// ISpVoice * pVoice = NULL;
//ISpVoicePtr cpVoice=NULL;
// HRESULT hr = CoCreateInstance(CLSID_SpV oice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
HRESULT hr = cpVoice.CoCreateInstance(C LSID_SpVoi ce);
// IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
// cpEnum->Item(0, &cpToken );
if(SUCCEEDED(hr))
{
// hr = SpEnumTokens(SPCAT_VOICES, L"Name=Microsoft Simplified Chinese", NULL, &cpEnum);
hr = SpEnumTokens(SPCAT_VOICES, L"Name=Microsoft Simplified Chinese", NULL, &cpEnum);
}
//Get the closest token
if(SUCCEEDED(hr))
{
hr = cpEnum ->Next(1, &cpToken, NULL);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
//set the output to the default audio device
/* if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP , 0, NULL);
pVoice->Release();
pVoice = NULL;
}*/
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
}
if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI P , 0, NULL);
// cpVoice->Release();
// cpVoice = NULL;
}
return CKBR_OK;
//Alex Added Here
CKBehavior* beh = BehContext.Behavior;
/* CComPtr<ISpVoice> cpVoice;
CComPtr<IEnumSpObjectToken
CComPtr<ISpObjectToken> cpToken;*/
CComPtr<ISpVoice> cpVoice;
CComPtr<IEnumSpObjectToken
//typedef _com_ptr_t<_com_IIID<ISpVo
typedef _com_ptr_t<_com_IIID<ISpOb
//typedef _com_ptr_t<_com_IIID<IEnum
//typedef _com_ptr_t<_com_IIID<ISpVo
beh->ActivateInput(0,FALSE
beh->ActivateOutput(0);
char sIP[300];
beh->GetInputParameterValu
//BehContext.Context->Outp
beh->SetOutputParameterVal
TCHAR wsIP[300];
MultiByteToWideChar(CP_ACP
//ISpVoiceVoicePtr cpVoice;
//////////////////////////
// ISpVoice * pVoice = NULL;
//ISpVoicePtr cpVoice=NULL;
// HRESULT hr = CoCreateInstance(CLSID_SpV
HRESULT hr = cpVoice.CoCreateInstance(C
// IEnumSpObjectTokensPtr cpEnum;
ISpObjectTokenPtr cpToken;
// cpEnum->Item(0, &cpToken );
if(SUCCEEDED(hr))
{
// hr = SpEnumTokens(SPCAT_VOICES,
hr = SpEnumTokens(SPCAT_VOICES,
}
//Get the closest token
if(SUCCEEDED(hr))
{
hr = cpEnum ->Next(1, &cpToken, NULL);
}
if(SUCCEEDED(hr))
{
hr = cpVoice->SetVoice( cpToken);
}
//set the output to the default audio device
/* if( SUCCEEDED( hr ) )
{
hr = pVoice->Speak((LPWSTR)wsIP
pVoice->Release();
pVoice = NULL;
}*/
if(SUCCEEDED(hr))
{
hr = cpVoice->SetOutput( NULL, TRUE );
}
if( SUCCEEDED( hr ) )
{
hr = cpVoice->Speak((LPWSTR)wsI
// cpVoice->Release();
// cpVoice = NULL;
}
return CKBR_OK;
ASKER
it works
BTW, do you know can we program MS Agent? but I want to hide the characters but can still perform the same TTS as the above code
BTW, do you know can we program MS Agent? but I want to hide the characters but can still perform the same TTS as the above code
>unresolved external symbol "void __stdcall _com_issue_error(long)
looks like you forgot to add the comsupp.lib in the project dependencies
looks like you forgot to add the comsupp.lib in the project dependencies
sorry, i never used MS Agent...
i only know the ms Agent is using sapi4 for TTS
i only know the ms Agent is using sapi4 for TTS
ASKER
I have to try tmr about the comsupp.lib
so I will try to dig out the MS Agent and try to combine with my code and see it can produce different language or not.
Hope you can still help
so I will try to dig out the MS Agent and try to combine with my code and see it can produce different language or not.
Hope you can still help
well sapi5 does support different languages...
it depends on the voice you are choosing. You also can use the voices of the MS Agent, but than you have to use the sapi4 interface, cuz the voices MS Agent is using are sapi4.
You can get the language code id of a sapi5 voice from its token:
#include <sstream>
#include <algorithm>
typedef long int32;
...
std::vector<int32> getLcids(const ISpObjectTokenPtr& token)
{
// get lcids as string seperated with ";"
ISpDataKeyPtr attrib;
if (token->OpenKey(L"Attribut es", &attrib) != S_OK) return std::vector<int32>();
wchar_t * dstr = 0;
std::wstring str;
if (attrib->GetStringValue(L" Language", &dstr) == S_OK)
str= dstr;
CoTaskMemFree(dstr);
// seperate strings and convert to int32
std::vector<int32> ret;
if (str.empty()) return ret;
std::vector<std::wstring> v;
typedef std::wstring::const_iterat or iter;
iter i = str.begin();
while (i != str.end()) {
// ignore leading blanks
i = find_if(i, str.end(), non_sc);
// find end of next word
iter j = find_if(i, str.end(), is_sc);
// copy the characters in `[i,' `j)'
if (i != str.end())
v.push_back(std::wstring(i , j));
i = j;
}
if (v.empty()) return ret;
for (std::vector<std::wstring> ::const_it erator iter = v.begin(); iter != v.end(); ++iter)
{
std::wistringstream sstr(*iter);
int32 tmp;
sstr >> std::hex >> tmp;
ret.push_back(tmp);
}
return ret;
}
it depends on the voice you are choosing. You also can use the voices of the MS Agent, but than you have to use the sapi4 interface, cuz the voices MS Agent is using are sapi4.
You can get the language code id of a sapi5 voice from its token:
#include <sstream>
#include <algorithm>
typedef long int32;
...
std::vector<int32> getLcids(const ISpObjectTokenPtr& token)
{
// get lcids as string seperated with ";"
ISpDataKeyPtr attrib;
if (token->OpenKey(L"Attribut
wchar_t * dstr = 0;
std::wstring str;
if (attrib->GetStringValue(L"
str= dstr;
CoTaskMemFree(dstr);
// seperate strings and convert to int32
std::vector<int32> ret;
if (str.empty()) return ret;
std::vector<std::wstring> v;
typedef std::wstring::const_iterat
iter i = str.begin();
while (i != str.end()) {
// ignore leading blanks
i = find_if(i, str.end(), non_sc);
// find end of next word
iter j = find_if(i, str.end(), is_sc);
// copy the characters in `[i,' `j)'
if (i != str.end())
v.push_back(std::wstring(i
i = j;
}
if (v.empty()) return ret;
for (std::vector<std::wstring>
{
std::wistringstream sstr(*iter);
int32 tmp;
sstr >> std::hex >> tmp;
ret.push_back(tmp);
}
return ret;
}
ASKER
hi
"well sapi5 does support different languages..."
Are you sure? I read the specification of the SDK, and it said for TTS, only supported Simple Chinese and English. That's why I want to use MS Agent.
If so it is a good news, how to do it?
Your code can do so?
let me read first...
"well sapi5 does support different languages..."
Are you sure? I read the specification of the SDK, and it said for TTS, only supported Simple Chinese and English. That's why I want to use MS Agent.
If so it is a good news, how to do it?
Your code can do so?
let me read first...
ASKER
In my code, I try to get the toketn (ie. get different languages) already but I assume that user installed the TTS Language pack in their computer and so my system contains only English and Simply Chinese TTS which can be found in the registry key.
So you said we SAPI support different language, do we need to install anything? MS Agent?
So you said we SAPI support different language, do we need to install anything? MS Agent?
well,
the default sapi5 languages installed with windows are only english. but there are many tts modules for sapi4/sapi5 from different companys. Most of them not for free (particularly the high quality voices and sapi5 voices). For sapi4 you will get many free voices from the internet (like the one form MS Agent: http://www.microsoft.com/msagent/downloads/user.asp#tts).
If you want to use both, you need a interface that can work with sapi4 and sapi5. In this case you have to write an abstaction layer for the function you need and implement them for the sapi4 and sapi5 interface.
the default sapi5 languages installed with windows are only english. but there are many tts modules for sapi4/sapi5 from different companys. Most of them not for free (particularly the high quality voices and sapi5 voices). For sapi4 you will get many free voices from the internet (like the one form MS Agent: http://www.microsoft.com/msagent/downloads/user.asp#tts).
If you want to use both, you need a interface that can work with sapi4 and sapi5. In this case you have to write an abstaction layer for the function you need and implement them for the sapi4 and sapi5 interface.
ASKER
oh too complicated to me.
hm...if MS Agent can provide different languages, I prefer to develop the SAPI4
let see how it works...
Do you mind to tell me what is the best way to learn VC++? I found it is quite hard to manage.
hm...if MS Agent can provide different languages, I prefer to develop the SAPI4
let see how it works...
Do you mind to tell me what is the best way to learn VC++? I found it is quite hard to manage.
ASKER
This is the code from MS Agent
Before I try to modify it, do you think it doesn't load the character and it can still read a text, say from a textbox, and it can pronounce?
#ifndef STRICT
#define STRICT
#endif
//======================== ========== ========== ========== ========== ==========
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (C) 1997-1998 Microsoft Corporation. All Rights Reserved.
//
//------------------------ ---------- ---------- ---------- ---------- ----------
//
// This sample demonstrates the simplest Microsoft Agent application
//
//======================== ========== ========== ========== ========== ==========
#include <windows.h>
#include <tchar.h>
#include "AgtSvr.h"
#include "AgtSvr_i.c"
static const LPWSTR kpwzCharacterOld = L"\\program files\\microsoft agent\\characters\\genie.a cs";
static const LPTSTR kpszAppTitle = _T("Microsoft Agent Samples");
extern "C" int PASCAL WinMain(HINSTANCE hInst,
HINSTANCE hInstPrev,
LPSTR lpCmdLine,
int nCmdShow) {
HRESULT hRes;
_TCHAR szError[256];
VARIANT vPath;
BSTR bszSpeak;
long lCharID;
long lRequestID;
IAgentEx *pAgentEx;
IAgentCharacterEx *pCharacterEx = NULL;
// Initialize COM
if (FAILED(CoInitialize(NULL) )) {
MessageBox(NULL,
_T("There was an error initializing COM."),
kpszAppTitle,
MB_OK | MB_ICONERROR);
return -1;
}
// Create an instance of the Agent 2.0 server. NOTE: by
// asking for an IAgentEx interface we know we will get
// at least Agent 2.0. The CLSID also changed between
// 1.5 and 2.0 so we know we won't get the 1.5 server.
hRes = CoCreateInstance(CLSID_Age ntServer,
NULL,
CLSCTX_SERVER,
IID_IAgentEx,
(LPVOID *)&pAgentEx);
if (FAILED(hRes)) {
wsprintf(szError, _T("There was an error initializing Microsoft Agent, code = 0x%x"), hRes);
MessageBox(NULL,
szError,
kpszAppTitle,
MB_OK | MB_ICONERROR | MB_TOPMOST);
CoUninitialize();
return -1;
}
__try {
// First try to load the default character
VariantInit(&vPath);
vPath.vt = VT_EMPTY;
hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);
if (FAILED(hRes)) {
// There's no default character. See if we can load the
// character from the directory used in most version 1.5
// applications.
vPath.vt = VT_BSTR;
vPath.bstrVal = SysAllocString(kpwzCharact erOld);
if (vPath.bstrVal == NULL) {
hRes = E_OUTOFMEMORY;
__leave;
}
hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);
// Did we successfully load a character?
if (FAILED(hRes))
__leave;
}
// Get the IAgentCharacterEx interface
hRes = pAgentEx->GetCharacterEx(l CharID, &pCharacterEx);
if (FAILED(hRes))
__leave;
// Set the language of the character
hRes = pCharacterEx->SetLanguageI D(MAKELANG ID(LANG_EN GLISH, SUBLANG_ENGLISH_US));
if (FAILED(hRes))
__leave;
// Show the character. The first parameter tells Microsoft
// Agent to show the character by playing an animation.
hRes = pCharacterEx->Show(FALSE, &lRequestID);
if (FAILED(hRes))
__leave;
// Make the character speak
bszSpeak = SysAllocString(L"Hello World!");
hRes = pCharacterEx->Speak(bszSpe ak, NULL, &lRequestID);
SysFreeString(bszSpeak);
if (FAILED(hRes))
__leave;
// This is a very simplistic sample. Sleep for 10 seconds
// and then die.
Sleep(10000);
}
__finally {
if (FAILED(hRes)) {
wsprintf(szError, _T("An error occurred in Microsoft Agent, code = 0x%x"), hRes);
MessageBox(NULL,
szError,
kpszAppTitle,
MB_OK | MB_ICONERROR | MB_TOPMOST);
}
}
// Clean up
if (pCharacterEx) {
// Release the character interface
pCharacterEx->Release();
// Unload the character. NOTE: releasing the character
// interface does NOT make the character go away. You must
// call Unload.
pAgentEx->Unload(lCharID);
}
// Release the Agent
pAgentEx->Release();
VariantClear(&vPath);
CoUninitialize();
return 0;
}
Before I try to modify it, do you think it doesn't load the character and it can still read a text, say from a textbox, and it can pronounce?
#ifndef STRICT
#define STRICT
#endif
//========================
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
// PURPOSE.
//
// Copyright (C) 1997-1998 Microsoft Corporation. All Rights Reserved.
//
//------------------------
//
// This sample demonstrates the simplest Microsoft Agent application
//
//========================
#include <windows.h>
#include <tchar.h>
#include "AgtSvr.h"
#include "AgtSvr_i.c"
static const LPWSTR kpwzCharacterOld = L"\\program files\\microsoft agent\\characters\\genie.a
static const LPTSTR kpszAppTitle = _T("Microsoft Agent Samples");
extern "C" int PASCAL WinMain(HINSTANCE hInst,
HINSTANCE hInstPrev,
LPSTR lpCmdLine,
int nCmdShow) {
HRESULT hRes;
_TCHAR szError[256];
VARIANT vPath;
BSTR bszSpeak;
long lCharID;
long lRequestID;
IAgentEx *pAgentEx;
IAgentCharacterEx *pCharacterEx = NULL;
// Initialize COM
if (FAILED(CoInitialize(NULL)
MessageBox(NULL,
_T("There was an error initializing COM."),
kpszAppTitle,
MB_OK | MB_ICONERROR);
return -1;
}
// Create an instance of the Agent 2.0 server. NOTE: by
// asking for an IAgentEx interface we know we will get
// at least Agent 2.0. The CLSID also changed between
// 1.5 and 2.0 so we know we won't get the 1.5 server.
hRes = CoCreateInstance(CLSID_Age
NULL,
CLSCTX_SERVER,
IID_IAgentEx,
(LPVOID *)&pAgentEx);
if (FAILED(hRes)) {
wsprintf(szError, _T("There was an error initializing Microsoft Agent, code = 0x%x"), hRes);
MessageBox(NULL,
szError,
kpszAppTitle,
MB_OK | MB_ICONERROR | MB_TOPMOST);
CoUninitialize();
return -1;
}
__try {
// First try to load the default character
VariantInit(&vPath);
vPath.vt = VT_EMPTY;
hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);
if (FAILED(hRes)) {
// There's no default character. See if we can load the
// character from the directory used in most version 1.5
// applications.
vPath.vt = VT_BSTR;
vPath.bstrVal = SysAllocString(kpwzCharact
if (vPath.bstrVal == NULL) {
hRes = E_OUTOFMEMORY;
__leave;
}
hRes = pAgentEx->Load(vPath, &lCharID, &lRequestID);
// Did we successfully load a character?
if (FAILED(hRes))
__leave;
}
// Get the IAgentCharacterEx interface
hRes = pAgentEx->GetCharacterEx(l
if (FAILED(hRes))
__leave;
// Set the language of the character
hRes = pCharacterEx->SetLanguageI
if (FAILED(hRes))
__leave;
// Show the character. The first parameter tells Microsoft
// Agent to show the character by playing an animation.
hRes = pCharacterEx->Show(FALSE, &lRequestID);
if (FAILED(hRes))
__leave;
// Make the character speak
bszSpeak = SysAllocString(L"Hello World!");
hRes = pCharacterEx->Speak(bszSpe
SysFreeString(bszSpeak);
if (FAILED(hRes))
__leave;
// This is a very simplistic sample. Sleep for 10 seconds
// and then die.
Sleep(10000);
}
__finally {
if (FAILED(hRes)) {
wsprintf(szError, _T("An error occurred in Microsoft Agent, code = 0x%x"), hRes);
MessageBox(NULL,
szError,
kpszAppTitle,
MB_OK | MB_ICONERROR | MB_TOPMOST);
}
}
// Clean up
if (pCharacterEx) {
// Release the character interface
pCharacterEx->Release();
// Unload the character. NOTE: releasing the character
// interface does NOT make the character go away. You must
// call Unload.
pAgentEx->Unload(lCharID);
}
// Release the Agent
pAgentEx->Release();
VariantClear(&vPath);
CoUninitialize();
return 0;
}
just search google or in the expert-exchange database for "lerning c++"
You can try to call the Speak function with hidden character:
...
// don't show the character
//hRes = pCharacterEx->Show(FALSE, &lRequestID);
//if (FAILED(hRes))
// __leave;
// Make the character speak
bszSpeak = SysAllocString(L"Hello World!");
hRes = pCharacterEx->Speak(bszSpe ak, NULL, &lRequestID);
SysFreeString(bszSpeak);
...
...
// don't show the character
//hRes = pCharacterEx->Show(FALSE, &lRequestID);
//if (FAILED(hRes))
// __leave;
// Make the character speak
bszSpeak = SysAllocString(L"Hello World!");
hRes = pCharacterEx->Speak(bszSpe
SysFreeString(bszSpeak);
...
ASKER
thanks for your advice for learning C++. C++ is OK but VC++ is hard It added many extra codes
So let me try to combine my code with this MS Agent and see it can work out on differnet languages or not.
I think it should be ok, right? (I don't have strong confidence actually haha)
So let me try to combine my code with this MS Agent and see it can work out on differnet languages or not.
I think it should be ok, right? (I don't have strong confidence actually haha)
first try the demo with the hidden character if it is speaking...
ASKER
I don't know why my MS Agent cannot work
The agent jumps out but no sound
and your code is working because it doesn't jump out (but i can see a small icon in the tray, it is ok)
still figure out what happen
The agent jumps out but no sound
and your code is working because it doesn't jump out (but i can see a small icon in the tray, it is ok)
still figure out what happen
ASKER
finally it sounds.
but when I hide the wizard, no sound appears
but when I hide the wizard, no sound appears
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
>unresolved external symbol "void __stdcall _com_issue_error(long)
looks like you forgot to add the comsupp.lib in the project dependencies
This works well now!!! Thanks
I am working on the SAPI4 to different languages
Hope it works
looks like you forgot to add the comsupp.lib in the project dependencies
This works well now!!! Thanks
I am working on the SAPI4 to different languages
Hope it works
ASKER
HI Chip3d
do you mind to have a look of my new question?
do you mind to have a look of my new question?
no, maybe you should open a new Question for this...
ASKER
I opened already and posted here for a few days alredy
ups, sorry, i havent recognized
ASKER
so u see the post, right?
i find strange that in the Await question area, I cannot see my post
i find strange that in the Await question area, I cannot see my post
CComPtr can only be use in an ATL environment. So you have to create an Atl Project or use http://www.codeproject.com/com/ccomptr.asp for non Atl project.
You can also use the _com_ptr_t from comip.h (lib: comsupp.lib)
typedef _com_ptr_t<_com_IIID<ISpOb
typedef _com_ptr_t<_com_IIID<IEnum
_com_ptr_t automatically query to all supported compobjects, if it fail it will set the pointer to 0.
IEnumSpObjectTokensPtr cpEnum;
hr = SpEnumTokens(SPCAT_VOICES,
...