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
Application-Defined Routines / Speech Recognition Callback Routines


MySRCallBack

You can define a speech recognition callback routine to handle recognition notifications.

pascal void MySRCallBack (SRCallBackStruct *param);
param
A pointer to a speech recognition callback structure. See "Speech Recognition CallBack Structure" on page 1-50 for a description of this structure.
DESCRIPTION
Your speech recognition callback routine is called whenever the recognizer encounters one of the events specified in its kSRNotificationParam property. You can determine what event caused your routine to be called by inspecting the what field of the speech recognition callback structure specified by the param parameter.

Because the Speech Recognition Manager is not fully reentrant, you should not call any of its routines other than SRContinueRecognition or SRCancelRecognition from within your speech recognition callback routine. Accordingly, your callback routine should simply queue the notification for later processing by your software (for instance, when it receives background processing time).

IMPORTANT
If the event is of type kSRNotifyRecognitionBeginning (which occurs only if you request speech-begun notifications), you must call either SRContinueRecognition or SRCancelRecognition before speech recognition can continue. A recognizer that has issued a recognition notification suspends activity until you call one of these two functions.
In general, when your speech recognition callback routine receives the kSRNotifyRecognitionBeginning notification, it should queue an indication for your main code both to adjust the current language model (if necessary) and to call the SRContinueRecognition function. When your callback routine receives the kSRNotifyRecognitionDone notification, it should queue an indication for your main code to handle the recognition result passed in the message field of the speech recognition callback structure specified by the param parameter. You should make sure, however, that the message field contains a valid reference to a recognition result by inspecting the status field of that structure; if status contains any value other than noErr, the contents of the message field are undefined.

SPECIAL CONSIDERATIONS
When your callback routine is executed, your application is not the current process. As a result, some restrictions apply; for example, the current resource chain might not be that of your application.

SEE ALSO
See "Using Callback Routines" on page 1-28 for a sample speech recognition callback routine.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
22 JAN 1997