Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 1 - Introduction to Sound on the Macintosh / Sound Reference
Routines / Recording Sounds


Legacy Documentclose button

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.

SndRecordToFile

You can use SndRecordToFile to record sound data into a file.

FUNCTION SndRecordToFile (filterProc: ProcPtr; corner: Point; 
                           quality: OSType; 
                           fRefNum: Integer): OSErr;
filterProc
A pointer to a function that determines how user actions in the sound recording dialog box are filtered.
corner
The horizontal and vertical coordinates of the upper-left corner of the sound recording dialog box (in global coordinates).
quality
The desired quality of the recorded sound. The values you can use for this parameter are described on page 1-39.
fRefNum
The file reference number of an open file to save the audio data in.
DESCRIPTION
The SndRecordToFile function works just 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 the Sound Manager's SndStartFilePlay function. The SndRecordToFile function is always called synchronously.

Your application must open the file specified in the fRefNum parameter before calling the SndRecordToFile function. Your application must close the file sometime after calling SndRecordToFile.

SPECIAL CONSIDERATIONS
Because the SndRecordToFile function moves memory, you should not call it at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector for the SndRecordToFile function are
Trap macroSelector
_SoundDispatch$07080014

RESULT CODES
noErr0No error
userCanceledErr-128User canceled the operation
siBadSoundInDevice-221Invalid sound input device
siUnknownQuality-232Unknown quality
SEE ALSO
For an example of how to record a sound file using the SndRecordToFile function, see "Recording a Sound File" on page 1-31. See the chapter "Dialog Manager" in Inside Macintosh: Macintosh Toolbox Essentials for a complete description of event filter functions.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996