Carbon


SndRecord

Header: Sound.h Carbon status: Supported

Records sound resources into memory.

OSErr SndRecord (
    ModalFilterUPP filterProc, 
    Point corner, 
    OSType quality, 
    SndListHandle *sndHandle
);
Parameter descriptions
filterProc

A pointer to an event filter function that determines how user actions in the sound recording dialog box are filtered (similar to the filterProc parameter specified in a call to the ModalDialog function). By specifying your own filter function, you can override or add to the default actions of the items in the dialog box. If filterProc isn’t NULL, SndRecord filters events by calling the function that filterProc points to.

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.

sndHandle

On entry, a handle to some storage space or NULL. On exit, a handle to a valid sound resource (or unchanged, if the call did not execute successfully).

function result

A result code.

DISCUSSION

The SndRecord function records sound into memory. The recorded data has the structure of a format 1 'snd ' resource and can later be played using the SndPlay function or can be stored as a resource. SndRecord displays a sound recording 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 remaining recording time and the current microphone sound level.

The quality parameter defines the desired quality of the recorded sound. Currently, three values are recognized for the quality parameter. See “Sound Input Device and Sound Component Information Selectors”

The precise meanings of these parameters are defined by the sound input device 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. The quality siBestQuality does not compress the sound and provides the best quality output, but at the expense of increased memory use. The quality siBetterQuality is suitable for most nonvoice recording, and siGoodQuality is suitable for voice recording.

The sndHandle parameter is a handle to some storage space. If the handle is NULL, the Sound Input Manager allocates a handle of the largest amount of space that it can find in your application’s heap and returns this handle in the sndHandle parameter. The Sound Input Manager resizes the handle when the user clicks the Save button in the sound recording dialog box. If the sndHandle parameter passed to SndRecord is not NULL, the Sound Input Manager simply stores the recorded data in the location specified by that handle.

This input function is analogous to the Sound Manager functions SndPlay. By using this high-level function, you can be assured that your application presents a user interface that is consistent with that displayed by other applications doing sound input. SndRecord attempts to record sound data from the sound input hardware currently selected in the Sound In control panel.

SPECIAL CONSIDERATIONS

Because the SndRecord function moves memory, you should not call it at interrupt time.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)