Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 3 - Sound Input Manager / Sound Input Manager Reference
Application-Defined Routines / Sound Input Completion Routines


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.

MySICompletionRoutine

A sound input completion routine has the following syntax:

PROCEDURE MySICompletionRoutine (inParamPtr: SPBPtr);
inParamPtr
A pointer to the sound input parameter block that was used to initiate an asynchronous recording.
DESCRIPTION
The Sound Input Manager executes your sound input completion routine after recording terminates either because your application has called the SPBStopRecording function or because the prescribed limit is reached. The completion routine is called only for asynchronous recording.

A common use of a sound input completion routine is to set a global variable that alerts the application that it should dispose of a sound input parameter block that it had allocated for an asynchronous sound recording.

SPECIAL CONSIDERATIONS
Because a sound input completion routine is executed at interrupt time, it should not allocate, move, or purge memory (either directly or indirectly) and should not depend on the validity of handles to unlocked blocks.

If your sound input completion routine accesses your application's global variables, it must ensure that the A5 register contains the address of the boundary between the application global variables and the application parameters. Your application can pass the value of the A5 register to the sound input completion routine in the userLong field of the sound input parameter block. For more information on ensuring the validity of the A5 register, see the chapter "Memory Management Utilities" in Inside Macintosh: Memory.

Your sound input completion routine can determine whether an error occurred during recording by examining the error field of the sound input parameter block specified by inParamPtr. Your sound input completion routine can change the value of that field to alert the application that some other error has occurred.

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

RESULT CODES
noErr0No error
abortErr-27Asynchronous recording was cancelled
siNoSoundInHardware-220No sound input hardware available
siBadSoundInDevice-221Invalid sound input device
siNoBufferSpecified-222No buffer specified
siDeviceBusyErr-227Sound input device is busy

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996