Inside Macintosh: Sound Manager

| Previous | Chapter contents | Chapter top | Section top | Next |

Legacy Documentclose button

Important: Sound Input Manager 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.

Sound Input Completion Routines

You can specify a sound input completion routine in the completionRoutine field of a sound input parameter block that your application uses to initiate asynchronous recording directly from a device.

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

noErr

0

No error

abortErr

-27

Asynchronous recording was cancelled

siNoSoundInHardware

-220

No sound input hardware available

siBadSoundInDevice

-221

Invalid sound input device

siNoBufferSpecified

-222

No buffer specified

siDeviceBusyErr

-227

Sound input device is busy


© 1999 Apple Computer, Inc.

Inside Macintosh: Sound Manager

| Previous | Chapter contents | Chapter top | Section top | Next |

Legacy Documentclose button

Important: Sound Input Manager 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.