ISpRecoResult::GetAudio (Windows CE 5.0)

Send Feedback

This method creates an audio stream of the requested words from the audio data in the result object.

Even if there are no elements, that is, ulStartElement = 0 and cElements = 0, then the audio will still be played. There are "unrecognized" results that have no elements but do have audio.

An application can find the time offsets for each element by examining the retrieved phrase using ISpPhrase::GetPhrase.

HRESULT GetAudio(ULONG ulStartElement,ULONG cElements,ISpStreamFormat** ppStream); 

Parameters

  • ulStartElement
    [in] Element in the result data at which the audio stream starts.
  • cElements
    [in] Total number of words.
  • ppStream
    [out] Address of a pointer to an object implementing ISpStreamFormat that represents the audio data.

Return Values

The following table shows the possible return values.

Value Description
S_OK Function completed successfully.
E_INVALIDARG cElements is zero or the expected number of elements to count exceeds the number available.
E_POINTER ppStream is an invalid pointer.
SPERR_NO_AUDIO_DATA This result object does not have any audio data.
FAILED(hr) Appropriate error message.

Example

The following code snippet illustrates the use this method to retrieve the retained audio.

HRESULT hr = S_OK;
// ... obtain a recognition result object from the recognizer...
hr = cpRecoResult->GetAudio( 0, 0, &cpStreamFormat );
// Check hr
// check the format of the stream for fun...
hr = cpStreamFormat->GetFormat(&formatId, &pWaveFormatEx);
// Check hr

Requirements

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

See Also

ISpRecoResult | SAPI Interfaces

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.