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.
SPBBytesToMilliSeconds
You can use theSPBBytesToMilliSecondsfunction to determine the maximum duration of a recording that can fit in a buffer of a certain size.
FUNCTION SPBBytesToMilliSeconds (inRefNum: LongInt; VAR byteCount: LongInt): OSErr;
inRefNum- The device reference number of the sound input device, as obtained from the
SPBOpenDevicefunction.byteCount- On entry, a value in bytes. On exit, the number of milliseconds of recording on the device specified by the
inRefNumparameter that would be necessary to fill a buffer of such a size.DESCRIPTION
TheSPBBytesToMilliSecondsfunction reports how many milliseconds of audio data can be recorded in a buffer that isbyteCountbytes long, given the input device's current sample rate, sample size, number of channels, and compression factor.SPECIAL CONSIDERATIONS
You can call theSPBBytesToMilliSecondsfunction at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theSPBBytesToMilliSecondsfunction are
Trap macro Selector _SoundDispatch $04440014 RESULT CODES
noErr 0 No error siBadSoundInDevice -221 Invalid sound input device