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.
Sound Resources
Resources of type'snd '
(also called sound resources) can contain both sound commands and sound data, and are widely used by sound-producing applications. These resources provide a simple and portable way for you to incorporate sounds into your application. For example, the sounds that a user can select in the Sound control panel as the system alert sound are stored in the System file as'snd '
resources. The user can select the current system alert sound with the Alert Sounds control panel, as illustrated in Figure 1-11. More generally, you can load a sound resource into memory and then play it by calling theSndPlay
function.
The Sound Manager can read sound resources in two formats, format 1 or format 2. However, the format 2
- Note
- If you do not use the sound-recording routines provided by the Sound Input Manager, you must know the structure of
'snd '
resources before you can create them. For information on this, see the chapter "Sound Manager" in this book. You can also use theSetupSndHeader
function, described in the chapter "Sound Input Manager" in this book, to help you create an'snd '
resource.'snd '
resource is obsolete, so your application should use format 1'snd '
resources. For more information on the differences between format 1 and format 2'snd '
resources, see the chapter "Sound Manager" in this book.The format 1
'snd '
resource is the most general kind of sound resource. A format 1'snd '
resource can contain a sequence of Sound Manager commands and associated sound data (such as wave-table data or a sampled sound header that both describes a digitally recorded sound and includes the sampled-sound data itself). Your application can produce sounds simply by passing a handle to that resource to theSndPlay
function, which opens a sound channel and sends the commands and data contained in the resource into the channel. Alternatively, a format 1'snd '
resource might contain a sequence of commands that describe a sound, without providing any other sound data. For example, such a resource could contain a command that alters the amplitude (or loudness) of sound playing on a channel. In this case, your application can use theSndPlay
function to execute the commands on any channel.