Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Speech Recognition Manager /
Chapter 1 - Speech Recognition Manager / Speech Recognition Manager Reference
Data Structures


Speech Recognition CallBack Structure

When you receive a notification of recognition results through an application-defined callback routine (instead of using an Apple event handler), the Speech Recognition Manager sends your callback routine a pointer to a speech recognition callback structure, defined by the SRCallBackStruct data type.

Note
For information on writing a speech recognition callback routine, see "Speech Recognition Callback Routines" on page 1-85.
struct SRCallBackStruct {
   long                       what;
   long                       message;
   SRRecognizer               instance;
   OSErr                      status;
   short                      flags;
   long                       refcon;
};
typedef struct SRCallBackStruct SRCallBackStruct;
Field Description
what
A notification flag that indicates the kind of event that caused this notification to be issued. This field contains either kSRNotifyRecognitionBeginning or kSRNotifyRecognitionDone. See "Notification Flags" on page 1-45 for complete details on the available notification flags.
message
If the value of the status field is noErr and the value of the what field is kSRNotifyRecognitionDone, this field contains a reference to a recognition result. Your callback routine can inspect the properties of this recognition result to determine what the user said.
IMPORTANT
Note that your callback routine must release this reference (by calling SRReleaseObject) when it is finished using it. If the value of the status field is not noErr, the value of this field is undefined.
instance
A reference to the recognizer that issued this notification. You should not call SRReleaseObject on this recognizer reference in response to a recognition notification.
status
An error code indicating the status of the recognition. If the value of this field is noErr, the message field contains a reference to a recognition result. If the value of this field is kSRRecognitionDone and the value of the what field is kSRNotifyRecognitionDone, the recognizer finished without error but nothing belonging to that recognizer was recognized; in this case, the message field does not contain a reference to a recognition result. If the value of this field is any other value, some other error occurred.
flags
Reserved for use by Apple Computer, Inc.
refcon
An application-defined reference constant. The value in this field is the value you passed in the refcon field of a callback routine parameter structure (of type SRCallBackParam).

Previous Book Contents Book Index Next

© Apple Computer, Inc.
22 JAN 1997