Previous Book Contents Book Index Next

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

MySynchronizationCallback

A synchronization callback procedure has the following syntax:

PROCEDURE MySynchronizationCallback (chan: SpeechChannel; 
                                       refCon: LongInt;
                                       syncMessage: OSType);
chan
The speech channel that has finished processing input text.
refCon
The reference constant associated with the speech channel.
syncMessage
The synchronization message passed in the embedded command. Usually, you use this message to distinguish between several different types of synchronization commands, but you can use it any way you wish.
DESCRIPTION
The Speech Manager calls a speech channel's synchronization callback procedure whenever it encounters a synchronization command embedded in a text buffer. You might use the synchronization callback procedure to provide a callback not ordinarily provided. For example, you might inset synchronization commands at the end of every sentence in a text buffer, or you might enter synchronization commands after every numeric value in the text. However, to synchronize your application with phonemes or words, it makes more sense to use the built-in phoneme and word callback procedures, defined in "Phoneme Callback Procedure" on page 4-87 and "Word Callback Procedure" on page 4-88.

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 make a visual change in response to a synchronization command, then use the callback procedure to set a global flag variable. Your application's main event loop can check this flag and update the screen display 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