Carbon


SpeechErrorProcPtr

Header: SpeechSynthesis.h Carbon status: Supported

Defines an error callback function. Your error function handles syntax errors within commands embedded in a text buffer being processed by the Speech Manager.

typedef void(* SpeechErrorProcPtr) (
    SpeechChannel chan, 
    SInt32 refCon, 
    OSErr theError, 
    SInt32 bytePos
);

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

void MySpeechErrorCallback (
    SpeechChannel chan, 
    SInt32 refCon, 
    OSErr theError, 
    SInt32 bytePos
);
Parameter descriptions
chan

The speech channel that has finished processing input text.

refCon

The reference constant associated with the speech channel.

theError

The error that occurred in processing an embedded command.

bytePos

The number of bytes from the beginning of the text buffer being spoken to the error encountered.

DISCUSSION

The Speech Manager calls a speech channel’s error callback function whenever it encounters a syntax error within a command embedded in a text buffer it is processing. This can be useful during application debugging, to detect problems with commands that you have embedded in text buffers that your application speaks. It can also be useful if your application allows users to embed commands within text buffers. Your application might display an alert indicating that the Speech Manager encountered a problem in processing an embedded command.

Ordinarily, the error information that the Speech Manager provides the error callback function should be sufficient. However, if your application needs information about errors that occurred before the error callback function was enabled, the application (including the error callback function) can call the GetSpeechInfo function with the soErrors selector.

You can specify an error callback procedure by passing the soErrorCallBack selector to the SetSpeechInfo function.

SPECIAL CONSIDERATIONS

Because your callback function executes at interrupt time, you must not call any functions that might move or purge memory. If you need to display an alert box to the user, then use the callback function to set a global flag variable. Your application’s main event loop can check this flag and display the alert box if it is set.

Your callback function is able to access application global variables only if the A5 register is properly set. The Speech Manager sets A5 to the proper value if you provide your application’s A5 value by calling the SetSpeechInfo function with the soCurrentA5 selector.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)