Previous Book Contents Book Index Next

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

MySpeechDoneCallback

A speech-done callback procedure has the following syntax:

PROCEDURE MySpeechDoneCallback (chan: SpeechChannel; 
                                 refCon: LongInt);
chan
The speech channel that has finished processing input text.
refCon
The reference constant associated with the speech channel.
DESCRIPTION
If a speech-done callback procedure is installed in a speech channel, then the Speech Manager calls this procedure when it finishes speaking a buffer of text.

You might use a speech-done callback procedure if you need to update some visual indicator that shows what text is currently being spoken. For example, suppose your application passes text buffers to the Speech Manager one paragraph at a time. Your speech-done callback procedure might set a global flag variable to indicate to the application that the Speech Manager has finished speaking a paragraph. When a routine called by your application's main event loop checks the global flag variable and determines that it has been set, the routine might ensure that the next paragraph of text is visible.

You might use a speech-done callback procedure to set a flag variable that alerts the application that it should pass a new buffer of text to the Speech Manager. If you do so, however, there might be a noticeable pause as the Speech Manager switches from processing one text buffer to another. Ordinarily, it is easier to achieve this goal by using a text-done callback procedure, as described earlier.

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