Compartir a través de


ISpRecoContext::SetVoicePurgeEvent (Windows CE 5.0)

Send Feedback

This method sets SR engine events that stop audio output, and purges the current speaking queue. Applications can call this method when implementing "barge-in" 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 wants the voice object associated with the speech recognition context to stop and purge when the SR engine hears a sound.

HRESULT SetVoicePurgeEvent(ULONGLONG ullEventInterest);

Parameters

  • ullEventInterest
    [in] The set of flags indicating the event interest(s) for the set of speech recognition events. Possible events are defined by the SPEVENTENUM enumeration.

Return Values

The following table shows the possible return values.

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.

Remarks

The speech recognition context event interest will be updated to include the voice purge events. See ISpEventSource::SetInterest. To find the current voice purge event(s), the application should call ISpRecoContext::GetVoicePurgeEvent.

Example

The following code snippet illustrates the use of this method 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

Requirements

OS Versions: Windows CE .NET 4.1 and later.
Header: Sapi.h, Sapi.idl.
Link Library: Sapilib.lib.

See Also

ISpRecoContext | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.