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 theSPBBytesToMilliSeconds
function 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
SPBOpenDevice
function.byteCount
- On entry, a value in bytes. On exit, the number of milliseconds of recording on the device specified by the
inRefNum
parameter that would be necessary to fill a buffer of such a size.DESCRIPTION
TheSPBBytesToMilliSeconds
function reports how many milliseconds of audio data can be recorded in a buffer that isbyteCount
bytes long, given the input device's current sample rate, sample size, number of channels, and compression factor.SPECIAL CONSIDERATIONS
You can call theSPBBytesToMilliSeconds
function at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for theSPBBytesToMilliSeconds
function are
Trap macro Selector _SoundDispatch $04440014 RESULT CODES
noErr 0 No error siBadSoundInDevice -221 Invalid sound input device