Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 4 - Speech Manager / Speech Manager Reference
Application-Defined Routines / Error Callback Procedure


Legacy Documentclose button

Important: Inside Macintosh: Sound is deprecated as of Mac OS X v10.5. For new audio development in Mac OS X, use Core Audio. See the Audio page in the ADC Reference Library.

MyErrorCallback

An error callback procedure has the following syntax:

PROCEDURE MyErrorCallback (chan: SpeechChannel; refCon: LongInt;
                           error: OSErr; bytePos: LongInt);
chan
The speech channel that has finished processing input text.
refCon
The reference constant associated with the speech channel.
error
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.
DESCRIPTION
The Speech Manager calls a speech channel's error callback procedure 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 procedure should be sufficient. However, if your application needs information about errors that occurred before the error callback procedure was enabled, the application (including the error callback procedure) can call the GetSpeechInfo function with the soErrors selector.

SPECIAL CONSIDERATIONS
Because your callback procedure executes at interrupt time, you must not call any routines that might move or purge memory. If you need to display an alert box to the user, then use the callback procedure 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 procedure 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.

ASSEMBLY-LANGUAGE INFORMATION
Because a callback procedure is called at interrupt time, it must preserve all registers other than A0-A2 and D0-D2.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996