Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 4 - Speech Manager / Speech Manager Reference
Application-Defined Routines / Word 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.

MyWordCallback

A word callback procedure has the following syntax:

PROCEDURE MyWordCallback (chan: SpeechChannel; refCon: LongInt;
                           wordPos: LongInt; wordLen: Integer);
chan
The speech channel that has finished processing input text.
refCon
The reference constant associated with the speech channel.
wordPos
The number of bytes between the beginning of the text buffer and the beginning of the word about to be pronounced.
wordLen
The length in bytes of the word about to be pronounced.
DESCRIPTION
The Speech Manager calls a speech channel's word callback procedure just before it pronounces a word. You might use such a callback procedure, for example, to draw the word about to be spoken in a window. In this case, the callback procedure would set a global flag variable to indicate that the word being spoken is changing and another two global variables to wordPos and wordLen. A routine called by your application's main event loop could detect that the word being spoken is changing and draw the word in a window.

SPECIAL CONSIDERATIONS
Because your callback procedure executes at interrupt time, you must not call any routines that might move or purge memory.

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