SPEVENTLPARAMTYPE (Microsoft Speech Platform)

Microsoft Speech Platform SDK 11

Microsoft Speech Platform

SPEVENTLPARAMTYPE

SPEVENTLPARAMTYPE lists objects and data pointers attached to events. SPEVENTLPARAMTYPE specifies the type of the attached data, enabling the user to determine how to access the data, and how to release the data when finished with the event.
See the helper CSpEvent for more information about C++ class that has properties for accessing event-specific data, and a destructor to automatically cleanup attached data.

See the helper SpClearEvent for more information about releasing objects or memory attached to an event.

typedef enum SPEVENTLPARAMTYPE
{
    SPET_LPARAM_IS_UNDEFINED,
    SPET_LPARAM_IS_TOKEN,
    SPET_LPARAM_IS_OBJECT,
    SPET_LPARAM_IS_POINTER,
    SPET_LPARAM_IS_STRING
} SPEVENTLPARAMTYPE;

Elements

SPET_LPARAM_IS_UNDEFINED
The SPEVENT.lParam value represents an undefined value.
For example, all TTS events, except SPEI_VOICE_CHANGE and SPEI_TTS_BOOKMARK, do not have attached data, so the event type is SPET_LPARAM_IS_UNDEFINED.
The user does not need to release associated data, since there is no associated data.
SPET_LPARAM_IS_TOKEN
The SPEVENT.lParam value represents a pointer to an ISpObjectToken object.
For example, the TTS voice change event (i.e., SPEI_VOICE_CHANGE) includes a pointer to the new voice's object token, so the lParam type is SPET_LPARAM_IS_TOKEN.
The user must call IUnknown::Release on the lParam member (as pointer) to release the associated object token.
SPET_LPARAM_IS_OBJECT
The SPEVENT.lParam value represents a pointer to an object.
For example, the speech recognition event (i.e., SPEI_RECOGNITION) includes a pointer to the recognition result (e.g. ISpRecoResult), so the lParam type is SPET_LPARAM_IS_OBJECT.
The user must call IUnknown::Release on the lParam member (as pointer) to release the associated object token.
SPET_LPARAM_IS_POINTER
The SPEVENT.lParam value represents a memory pointer.
For example, the property string change event (i.e., SPEI_PROPERTY_STRING_CHANGE) includes a pointer to a block of memory that contains a string (e.g. WCHAR*), so the lParam type is SPET_LPARAM_IS_POINTER.
The user must call CoTaskMemFree on the lParam member (as pointer) to release the associated memory.
SPET_LPARAM_IS_STRING
The SPEVENT.lParam value represents a pointer to a string.
For example, the TTS bookmark event (i.e., SPEI_TTS_BOOKMARK) includes a pointer the bookmark name, so the lParam type is SPET_LPARAM_IS_STRING.
The user must call CoTaskMemFree on the lParam member (as pointer) to release the associated memory.