SPBRecordToFile
short fRefNum; a valid reference number for an open file
SPBPtr * inParamPtr; a pointer to a sound input parameter block
Boolean asynchFlag; TRUE=Record asynchronously a file. The sound data recorded is simply stored in the file, so it is up to your
application to insert whatever headers are needed to play the sound with the
fRefNum must contain a valid reference number for an open file. (In other
words, your application must first open the file with write access,
eventually close the file.)
to control the recording process. The following fields are relevant:
Æ inRefNum long 4 0 input device reference number
´ count long 4 4 number of bytes to record
´ milliseconds long 4 8 number of milliseconds to record
Æ completionRoutine long 4 20 pointer to completion routine
Æ interruptRoutine long 4 24 pointer to interrupt routine
Æ userLong long 4 28 for application's use ¨ error short 2 32 error returned after recording
Æ unused1 long 4 36 reserved
asynchFlag specifies whether the recording occurs asynchronously.
noErr (0) No error
permErr (-54) Attempt to open locked file for writing
siNoSoundInHardware (-220) No sound input hardware available
siBadSoundInDevice (-221) Invalid sound input device
siHardDriveTooSlow (-224) Hard drive too slow to record
Notes: The fields in the parameter block specified by the inParamPtr parameter
are identical to the fields in the parameter block passed to SPBRecord, except that the bufferLength and bufferPtr fields are not used. The
initialize it to NULL.
are read in from the sound input device. If compression is enabled, then the
samples written to the file are compressed.
If any errors occur during file writes, recording is suspended. All
File Manager errors are returned through the function's return value if the routine is called synchronously. If the routine is called asynchronously
and the completion routine is not NULL, the completion routine is called and
is passed a single parameter on the stack that points to the sound input
parameter block , SPB; any errors are returned in the error field of the sound input parameter block. The error field in the sound input parameter
block is 1 while input is active, 0 when input is complete, and less than 0 if
an error occurs.