Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 2 - Sound Manager / Sound Manager Reference
Application-Defined Routines / Callback Procedures


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.

MyCallbackProcedure

A callback procedure has the following syntax:

PROCEDURE MyCallbackProcedure (theChan: SndChannelPtr; 
                                 theCmd: SndCommand);
theChan
A pointer to the sound channel on which a callBackCmd command was issued.
theCmd
The sound command record in which a callBackCmd command was issued.
DESCRIPTION
The Sound Manager executes the callback procedure associated with a sound channel whenever it processes a callBackCmd command for the channel. You can use a callback procedure to set a global flag that alerts the application that it must dispose of the sound channel. Or, you can use a callback procedure so that your application can synchronize a series of sound commands with other actions.

SPECIAL CONSIDERATIONS
A callback procedure is called at interrupt time. It must not make any calls to the Memory Manager, either directly or indirectly. If your callback procedure needs to access your application's global variables, you must ensure that register A5 contains your application's A5. (You can use the userInfo field of the sound channel pointed to by the theChan parameter or the param2 field of the sound command specified in the theCmd parameter to pass that value to your callback procedure.)

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

SEE ALSO
For information on how you can use callback procedures when playing sound asynchronously, see "Using Callback Procedures" on page 2-47.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996