Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
4/8/2010

When a word is spoken into the phone, the engine will start listening to the wave-in device, and attempt to recognize the sound using this method. Recognizeaccepts a spoken word, attempts to match that word against a library of defined words, and then returns the corresponding action to take, or an error if the word was not recognized.

Syntax

HRESULT  Recognize (
  PSPRECOGNITIONMETHOD 
peRM,
  SPTYPEHEADER* 
psth,
  IUnknown* 
pUnk
);

Parameters

peRM

[out][in] Identifies which recognition method should be used, as possibly more than one method may be specified, and the engine should update this variable with the particular recognition method that is used.

psth

[out][in] Pointer to information about the recognized pattern.

Recognition method SPTYPEHEADER type

SPRM_CONTINUOUSDIGIT

SPT_BSTR, the string of recognized digits.

SPRM_VOICETAG

SPT_DWORD

pUnk

[in] Pointer to a client callback interface. This parameter is currently NULL and ignored.

Return Value

Value Description

S_OK

Success

E_ABORT

The operation was cancelled by a call to the CancelProcessingfunction.

E_ACCESSDENIED

Unable to access stored training samples.

E_FAIL

General failure.

E_INVALIDARG

The operation failed because there were one or more invalid arguments.

E_OUTOFMEMORY

The operation failed because there was inadequate memory.

SP_INSUFFICIENT_DATA

A sample was successfully obtained, however the recognition needs to be performed again; that is, the client should call the Train method again.

SPERR_AUDIO_BUFFER_OVERFLOW

The user spoke for longer than the maximum allowed time.

SPERR_BUFFER_TOO_SMALL

The caller provided a buffer that was too small to return a result; for example in the SPBSTR structure.

SPERR_DEVICE_BUSY

The wave device was busy.

SPERR_ENGINE_BUSY

The operation failed because the engine was busy servicing another request.

SPERR_NO_AUDIO_DATA

The audio data was silence, or its volume was too low.

SPERR_NO_WORD_PRONUNCIATION

The required training has not been completed.

SPERR_NOT_IN_LEX

The recognition could not find the spoken word in the lexicon.

SPERR_SR_ENGINE_EXCEPTION

General exception from the engine.

SPERR_TIMEOUT

The task could not complete because a timeout occurred during training or recognition.

SPERR_UNINITIALIZED

The operation failed because the engine was not properly initialized.

Otherwise, it returns an appropriate failure code from the return code list.

Remarks

The engine should not provide any recognition UI unless required. Should the engine require another recognition sample, it should return the SP_INSUFFICIENT_DATA error code and return to the client. At that point, the client can update its UI and call the Recognize method again.

Requirements

Header itspeech.h
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Smartphone 2002 and later

See Also