SndRecordToFile
SndRecordToFile Record a sound into a file
#include <SoundInput.h> Sound Manager
OSErr SndRecordToFile( filterProc, corner, quality, fRefNum);
ProcPtr filterProc; a pointer to a procedure
Point corner; coordinates of the upper-left corner of the dialog
box
OSType quality; the desired quality of the recorded sound
short fRefNum; indicates a file reference number
returns Error Code; 0=no error
You can use SndRecordToFile to record sound data into a file.
SndRecordToFile operates exactly like SndRecord except that it stores the
sound input data into a file. The resulting file is in either AIFF or
AIFF-C format and contains the information necessary to play the file by
using SndStartFilePlay. SndRecordToFile is always called synchronously.
filterProc determines how user actions in the dialog box are filtered (and
hence is similar to the filterProc parameter specified in a call to
ModalDialog). By specifying your own filter procedure, you can
override or add to the default actions of the items in the dialog box. If
filterProc is not NULL, SndRecord filters events by calling the
procedure that filterProc points to
corner gives the horizontal and vertical coordinates of the upper-left
corner of the dialog box (in global coordinates).
quality the desired quality of the recorded sound. Currently, three values
are recognized for the quality parameter: 'good', 'betr', and 'best'. The
precise meanings of these parameters are dependent on the sound
input driver. For Apple-supplied drivers, this parameter
determines whether the recorded sound is to be compressed, and if so,
whether at a 6:1 or a 3:1 ratio. A quality of 'best' does not compress
the sound and provides the best quality output, but at the expense of
memory. The quality 'betr' is suitable for most nonvoice recording,
and 'good' is suitable for voice recording.
fRefNum indicates the file reference number of an open file to save the audio
data in. (In other words, your application must first open the file
with write access, pass the returned file reference number to
SndRecordToFile, and eventually close the file.) If the audio data
to be recorded into a file is uncompressed, then SndRecordToFile
writes a file of type AIFF. If the data is compressed,
SndRecordToFile writes a file of type AIFF-C
Returns: an operating system Error Code.
noErr (0) No error
userCanceledErr (-128) User canceled the ope ration
siBadSoundInDevice (-221) Invalid sound input device
siUnknownQuality (-232) Unknown quality

Notes: SndRecord displays a sound input dialog box and is always called
synchronously. Controls in the dialog box allow the user to start, stop,
pause, and resume sound recording, as well as to play back the recorded
sound. The dialog box also lists the amount of time remaining to record and
the current microphone sound level.