You are reading help file online using chmlib.com
|
ISpRecoResult::SpeakAudio retrieves and speaks the specified audio. This combines two other methods; first calling ISpRecoResult::GetAudio and then calling ISpVoice::SpeakStream on the parent recognition context.
HRESULT SpeakAudio(
ULONG ulStartElement,
ULONG cElements,
DWORD dwFlags,
ULONG *pulStreamNumber
);
Value | Description |
---|---|
S_OK | Function completed successfully. |
SPERR_NO_AUDIO_DATA | Result does not contain audio data. |
E_POINTER | pulStreamNumber is a non-NULL, bad pointer. |
FAILED(hr) | Appropriate error message. |
Even if there are no elements, that is, ulStartElement = 0 and cElements = 0, the audio will still be spoken. These are unrecognized results that have no elements, but do have audio.
If the application did not activate retained audio (see ISpRecoContext::SetAudioOptions), or make a previous call to ISpPhrase::Discard and eliminate the retained audio, ::SpeakAudio will fail with SPERR_NO_AUDIO_DATA.
The following code snippet illustrates the use of ISpObjectToken::IsUISupported using SPGUID_EngineProperties.
HRESULT hr = S_OK;
// ... get a recognition result object from the SR engine
// replay the user's spoken audio to the user
hr = cpRecoResult->SpeakAudio( 0, 0, 0, &ulStreamNum );
// Check hr
You are reading help file online using chmlib.com
|