Share via


ISpRecoContext::SetVoicePurgeEvent (Windows Embedded CE 6.0)

1/6/2010

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.

Syntax

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 Value

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

Header sapi.h, sapi.idl
Library sapilib.lib
Windows Embedded CE Windows CE .NET 4.1 and later

See Also

Reference

ISpRecoContext
SAPI Interfaces