Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 3 - Sound Input Manager / Sound Input Manager Reference
Sound Input Manager Routines / Converting Between Milliseconds and Bytes


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.

SPBMilliSecondsToBytes

You can use the SPBMilliSecondsToBytes function to determine how many bytes a recording of a certain duration will use.

FUNCTION SPBMilliSecondsToBytes (inRefNum: LongInt; 
                              VAR milliseconds: LongInt): OSErr;
inRefNum
The device reference number of the sound input device, as obtained from the SPBOpenDevice function.
milliseconds
On entry, the duration of the recording in milliseconds. On exit, the number of bytes that sampled-sound data would occupy for a recording of the specified duration on the device specified by the inRefNum parameter.
DESCRIPTION
The SPBMilliSecondsToBytes function reports how many bytes are required to store a recording of duration milliseconds, given the input device's current sample rate, sample size, number of channels, and compression factor.

SPECIAL CONSIDERATIONS
You can call the SPBMilliSecondsToBytes function at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the SPBMilliSecondsToBytes function are
Trap macroSelector
_SoundDispatch$04400014

RESULT CODES
noErr0No error
siBadSoundInDevice-221Invalid sound input device

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996