Inside Macintosh: Sound Manager
| Previous | Chapter contents | Chapter top | Section top | Next |
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.
The Sound Input Manager provides two routines that allow you to convert between millisecond and byte recording values.
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;
The device reference number of the sound input device, as obtained from the SPBOpenDevice function.
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.
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.
You can use the SPBBytesToMilliSeconds 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;
The device reference number of the sound input device, as obtained from the SPBOpenDevice function.
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.
The SPBBytesToMilliSeconds function reports how many milliseconds of audio data can be recorded in a buffer that is byteCount bytes long, given the input device's current sample rate, sample size, number of channels, and compression factor.
Inside Macintosh: Sound Manager
| Previous | Chapter contents | Chapter top | Section top | Next |
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.