SAPI-Lite Implementation Considerations

Send Feedback

The ISpRecognizerLite interface is the light speech API (SAPI), which handles the voice recognition functionality of the phone. It is a very simple, yet lightweight, wrapper for a speech recognition engine.

Threading Model

Its calls are synchronous and block the calling thread until it is completed. While the engine is processing, calls coming in from other threads should be detected. Using a mutex, or similar synchronization method, the engine should immediately return SPERR_ENGINE_BUSY. The one exception is the Abort method call, which can be called on a different thread, and will immediately abort any action being processed on the other thread, in which case, the aborted function returns E_ABORT, ASAP. However, there should be multiple instances of the engine instantiated by multiple clients, but they should not be using those instances at the same time.

User Interface

Not all functions implement a UI, unless required. Therefore, all user interfaces must be provided by client applications.

Usage of the SPTYPEHEADER Parameter

Essentially, this is a void pointer with an associated type and size. It reads the type and then casts it to the associated structure, such as "cast SPT_DWORD to SPDWORD."

Use the SPTYPEHEADER parameter in place to allow different data types to be passed around for different recognition contexts. This will prevent an explosion of interface changes when new recognition contexts are added.

Therefore, there is a great deal of flexibility to accommodate different engines, pattern identifiers, and so on.

For string buffers, the cbSize should always reflect the size of the buffer, never the length of the string. The string may be NULL terminated and less than the size of the buffer.

Methods That Must Be Implemented (Required)

Methods That Are Optional

(IMPLEMENTED AS NEEDED and return E_NOTIMPL)

Note   General return codes are defined either in the standard windows header file, Winerror.h, or in the standard SAPI header file, Sperror.h. For more information about error codes, see SAPI-Lite Error Codes.

See Also

Speaker-Dependent Speech Support

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.