Hello!
I am using SAPI 5.1 for an application text-to-speech.
I need to do the operation text-to-speech to a wav file and access information triggered by events in order to save
it to a structure of data.
I can save the wav files correctly, but I can not access the events.
here is the code to speak to wav file:
CSpStreamFormat OriginalFmt;
hr = m_cpVoice->GetOutputStream( &cpOldStream );
if (hr == S_OK)
{
hr = OriginalFmt.AssignFormat(cpOldStream);
}
else
{
hr = E_FAIL;
}
// User SAPI helper function in sphelper.h to create a wav file
if (SUCCEEDED(hr))
{
hr = SPBindToFile( m_szWFileName, SPFM_CREATE_ALWAYS, &cpWavStream, &OriginalFmt.FormatId(), OriginalFmt.WaveFormatExPtr() );
}
if( SUCCEEDED( hr ) )
{
// Set the voice's output to the wav file instead of the speakers
hr = m_cpVoice->SetOutput(cpWavStream, TRUE);
}
if ( SUCCEEDED( hr ) )
{
// Do the Speak
HandleSpeak(aux_entrada,pitch, speed, volume, true, wsVoice, true); // process events
}
m_cpVoice->WaitUntilDone( INFINITE );
cpWavStream.Release();
|
Can you help me?
Thanks
Pedro