Important: The information in this document is obsolete and should not be used for new development.
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 itskSRNotificationParamproperty. You can determine what event caused your routine to be called by inspecting thewhatfield of the speech recognition callback structure specified by theparamparameter.Because the Speech Recognition Manager is not fully reentrant, you should not call any of its routines other than
SRContinueRecognitionorSRCancelRecognitionfrom 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).
In general, when your speech recognition callback routine receives the
- IMPORTANT
- If the event is of type
kSRNotifyRecognitionBeginning(which occurs only if you request speech-begun notifications), you must call eitherSRContinueRecognitionorSRCancelRecognitionbefore speech recognition can continue. A recognizer that has issued a recognition notification suspends activity until you call one of these two functions.![]()
kSRNotifyRecognitionBeginningnotification, it should queue an indication for your main code both to adjust the current language model (if necessary) and to call theSRContinueRecognitionfunction. When your callback routine receives thekSRNotifyRecognitionDonenotification, it should queue an indication for your main code to handle the recognition result passed in themessagefield of the speech recognition callback structure specified by theparamparameter. You should make sure, however, that themessagefield contains a valid reference to a recognition result by inspecting thestatusfield of that structure; ifstatuscontains any value other thannoErr, the contents of themessagefield 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.