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.
Controlling Volume Levels
You can use theGetSysBeepVolume
andSetSysBeepVolume
functions to get and set the volume level of the system alert sound. You can useGetDefaultOutputVolume
andSetDefaultOutputVolume
to get and set the default output volume for a particular output device.
With all of these functions, you specify a volume with a 16-bit value, where 0 represents no volume (that is, silence) and 256 (hexadecimal $0100) represents full volume. The right and left volumes of a stereo sound are encoded as the high word and the low word, respectively, of a 32-bit value. Moreover, it's possible to overdrive a particular volume level if you need to amplify a low signal. For example, the long word $02000200 specifies a volume level of twice full volume on both the left and right channels of a stereo sound.
- IMPORTANT
- These four functions are available only in Sound Manager version 3.0 and later.
In addition to the four functions described in this section, Sound Manager version 3.0 introduces two new sound commands,
getVolumeCmd
andvolumeCmd
, that you can use to get and set the volume of a particular sound channel. See page 2-96 for details on these two sound commands; see "Managing Sound Volumes" beginning on page 2-31 for a code listing that uses thevolumeCmd
command.
Subtopics
- GetSysBeepVolume
- SetSysBeepVolume
- GetDefaultOutputVolume
- SetDefaultOutputVolume