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 itskSRNotificationParam
property. You can determine what event caused your routine to be called by inspecting thewhat
field of the speech recognition callback structure specified by theparam
parameter.Because the Speech Recognition Manager is not fully reentrant, you should not call any of its routines other than
SRContinueRecognition
orSRCancelRecognition
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).
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 eitherSRContinueRecognition
orSRCancelRecognition
before speech recognition can continue. A recognizer that has issued a recognition notification suspends activity until you call one of these two functions.![]()
kSRNotifyRecognitionBeginning
notification, it should queue an indication for your main code both to adjust the current language model (if necessary) and to call theSRContinueRecognition
function. When your callback routine receives thekSRNotifyRecognitionDone
notification, it should queue an indication for your main code to handle the recognition result passed in themessage
field of the speech recognition callback structure specified by theparam
parameter. You should make sure, however, that themessage
field contains a valid reference to a recognition result by inspecting thestatus
field of that structure; ifstatus
contains any value other thannoErr
, the contents of themessage
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.