You are reading help file online using chmlib.com
|
ISpRecoContext::SetVoicePurgeEvent sets the SR engine events that stop audio output, and purges the current speaking queue.
HRESULT SetVoicePurgeEvent(
ULONGLONG ullEventInterest
);
Value | Description |
---|---|
S_OK | Function completed successfully. |
E_INVALIDARG | One or more of the event interests set is not allowed. |
FAILED(hr) | Appropriate error message. |
The ISpRecoContext event interest will be updated to include the Voice Purge Events (see ISpEventSource::SetInterest).
To find the current Voice Purge Event(s), use ISpRecoContext::GetVoicePurgeEvent
Applications can call SetVoicePurgeEvent when implementing "barge-in" type functionality. For example, when a user calls a telephony server, and the server uses TTS Voice prompts, the Voice should stop speaking when the user is speaking. The application would want the associated Voice object of the ISpRecoContext (see ISpRecoContext::GetVoice) to stop and purge when the SR engine hears a sound (see SPEI_SOUND_START).
The following code snippet illustrates the use of ISpRecoContext::SetVoicePurgeEvent and "barge-in" setup
HRESULT hr = S_OK;
// create a shared recognition context
hr = cpRecoContext.CoCreateInstance(CLSID_SpSharedRecoContext);
// Check hr
// create a voice from the context (with same audio format as context)
hr = cpRecoContext->GetVoice(&cpVoice);
// Check hr
// tell the associated Voice to stop speaking when the SR Engine hears a recognizable sound
hr = cpRecoContext->SetVoicePurgeEvent(SPFEI(SPEI_SOUND_START));
// Check hr
You are reading help file online using chmlib.com
|