Carbon


SRCallBackProcPtr

Header: SpeechRecognition.h Carbon status: Supported

Defines a pointer to a speech recognition callback routine to handle recognition notifications. Your speech recognition callback routine is called whenever the recognizer encounters one of the events specified in its kSRNotificationParam property.

typedef void(* SRCallBackProcPtr) (
    SRCallBackStruct *param
);

You would declare your function like this if you were to name it MySRCallBackCallback:

void MySRCallBackCallback (
    SRCallBackStruct *param
);
Parameter descriptions
param

A pointer to a speech recognition callback structure. See SRCallBackStruct for a description of this structure.

DISCUSSION

You can receive notification of recognizer events either by installing an Apple event handler or by installing a speech recognition callback routine. In general, you should use an Apple event handler to process recognition notifications. You should use callback routines only for executable code that cannot easily receive Apple events.

You can determine what event caused your function 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 functions 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).

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.

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.


© 2000 Apple Computer, Inc. (Last Updated 7/10/2000)