Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 5 - Sound Components / Sound Components Reference
Constants


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.

Sound Component Information Selectors

The Sound Manager calls your sound component's SoundComponentGetInfo and SoundComponentSetInfo functions to determine the capabilities of your component and to change those capabilities. It passes those functions a sound component information selector in the function's selector parameter to specify the type of information it wants to get or set. The available sound component information selectors are defined by constants.

Note
Most of these selectors can be passed to both SoundComponentGetInfo and SoundComponentSetInfo. Some of them, however, can be sent to only one or the other.
#define siChannelAvailable       'chav'   /*number of channels available*/
#define siCompressionAvailable   'cmav'   /*compression types available*/
#define siCompressionFactor      'cmfa'   /*current compression factor*/
#define siCompressionType        'comp'   /*current compression type*/
#define siHardwareMute           'hmut'   /*current hardware mute state*/
#define siHardwareVolume         'hvol'   /*current hardware volume*/
#define siHardwareVolumeSteps    'hstp'   /*number of hardware volume steps*/
#define siHeadphoneMute          'pmut'   /*current headphone mute state*/
#define siHeadphoneVolume        'pvol'   /*current headphone volume*/
#define siHeadphoneVolumeSteps   'hdst'   /*num. of headphone volume steps*/
#define siNumberChannels         'chan'   /*current number of channels*/
#define siQuality                'qual'   /*current quality*/
#define siRateMultiplier         'rmul'   /*current rate multiplier*/
#define siSampleRate             'srat'   /*current sample rate*/
#define siSampleRateAvailable    'srav'   /*sample rates available*/
#define siSampleSize             'ssiz'   /*current sample size*/
#define siSampleSizeAvailable    'ssav'   /*sample sizes available*/
#define siSpeakerMute            'smut'   /*current speaker mute*/
#define siSpeakerVolume          'svol'   /*current speaker volume*/
#define siVolume                 'volu'   /*current volume setting*/
Constant descriptions

siChannelAvailable
Get the maximum number of channels this sound component can manage, as well as the channels themselves. The infoPtr parameter points to a record of type SoundInfoList, which contains an integer (the number of available channels) and a handle to an array of integers (which represent the channel numbers themselves).
siCompressionAvailable
Get the number and list of compression types this sound component can manage. The infoPtr parameter points to a record of type SoundInfoList, which contains the number of compression types, followed by a handle that references a list of compression types, each of type OSType.
siCompressionFactor
Get information about the current compression type. The infoData parameter points to a compression information record (see page 5-32).
siCompressionType
Get or set the current compression type. The infoPtr parameter points to a buffer of type OSType, which is the compression type.
siHardwareMute
Get or set the current mute state of the audio hardware. A value of 0 indicates that the hardware is not muted, and a value of 1 indicates that the hardware is muted. Not all sound components need to support this selector; it's intended for sound output device components whose associated hardware can be muted.
siHardwareVolume
Get or set the current volume level of all sounds produced on the sound output device. The infoPtr parameter points to a long integer, where the high-order word represents the right volume level and the low-order word represents the left volume level. A volume level is specified by an unsigned 16-bit number: 0x0000 represents silence and 0x0100 represents full volume. (You can use the constant kFullVolume for full volume.) You can specify values larger than 0x0100 to overdrive the volume, although doing so might result in clipping. This selector applies to the volume of the output device, whereas the siVolume selector applies to the volume of a specific sound channel and its component chain. If a sound output device supports more than one output port (for example, both headphones and speakers), the siHardwareVolume selector applies to all those ports.
siHardwareVolumeSteps
Get the number of audible volume levels supported by the audio hardware. If the device supports a range of volume levels (for example, 0x000 to 0x1000), you should return only the number of levels that are audible. The Sound Manager uses this information to handle the volume slider in the Alert Sounds control panel.
siHeadphoneMute
Get or set the current mute state of the headphone. A value of 0 indicates that the headphone is not muted, and a value of 1 indicates that the headphone is muted. Not all sound components need to support this selector; it's intended for sound output device components whose associated headphone can be muted.
siHeadphoneVolume
Get or set the current volume level of all sounds produced on the headphone. The infoPtr parameter points to a long integer, where the high-order word represents the right volume level and the low-order word represents the left volume level. A volume level is specified by an unsigned 16-bit number: 0x0000 represents silence and 0x0100 represents full volume. (You can use the constant kFullVolume for full volume.) You can specify values larger than 0x0100 to overdrive the volume, although doing so might result in clipping. This selector applies to the volume of the headphones.
siHeadphoneVolumeSteps
Get the number of audible volume levels supported by the headphones. If the headphones support a range of volume levels (for example, 0x000 to 0x1000), you should return only the number of levels that are audible.
siNumberChannels
Get or set the current number of audio channels currently being managed by the sound component. The infoPtr parameter points to an integer, which is the number of channels. For example, for stereo sounds, this integer should be 2.
siQuality
Get or set the current quality setting for the sound component. The infoPtr parameter points to a 32-bit value, which typically determines how much processing should be applied to the audio data stream.
siRateMultiplier
Get or set the current rate multiplier for the sound component. The infoPtr parameter points to a buffer of type UnsignedFixed, which is the multiplier to be applied to the playback rate of the sound, independent of the base sample rate of the sound. For example, if the current rate multiplier is 2.0, the sound is played back at twice the speed specified in the sampleRate field of the sound component data record.
siSampleRate
Get or set the current sample rate of the data being output by the sound component. The infoPtr parameter points to a buffer of type UnsignedFixed, which is the sample rate.
siSampleRateAvailable
Get the range of sample rates this sound component can handle. The infoPtr parameter points to a record of type SoundInfoList, which is the number of sample rates the component supports, followed by a handle to a list of sample rates, each of type UnsignedFixed. The sample rates can be in the range 0 to 65535.65535. If the number of sample rates is 0, then the first two sample rates in the list define the lowest and highest values in a continuous range of sample rates.
siSampleSize
Get or set the current sample size of the audio data being output by the sound component. The infoPtr parameter points to an integer, which is the sample size in bits.
siSampleSizeAvailable
Get the range of sample sizes this sound component can handle. The infoPtr parameter points to a record of type SoundInfoList, which is the number of sample sizes the sound component supports, followed by a handle. The handle references a list of sample sizes, each of type Integer. Sample sizes are specified in bits.
siSpeakerMute
Get or set the current mute state of the speakers. A value of 0 indicates that the speakers are not muted, and a value of 1 indicates that the speakers are muted. Not all sound components need to support this selector; it's intended for sound output device components whose associated speakers can be muted.
siSpeakerVolume
Get or set the current volume level of all sounds produced on the speakers. The infoPtr parameter points to a long integer, where the high-order word represents the right volume level and the low-order word represents the left volume level. A volume level is specified by an unsigned 16-bit number: 0x0000 represents silence and 0x0100 represents full volume. (You can use the constant kFullVolume for full volume.) You can specify values larger than 0x0100 to overdrive the volume, although doing so might result in clipping. This selector applies to the volume of the speakers.
siVolume
Get or set the current volume level of the sound component. The infoPtr parameter points to a long integer, where the high-order word represents the right volume level and the low-order word represents the left volume level. A volume level is specified by an unsigned 16-bit number: 0x0000 represents silence and 0x0100 represents full volume. (You can use the constant kFullVolume for full volume.) You can specify values larger than 0x0100 to overdrive the volume, although doing so might result in clipping. This selector applies to the volume of a specific sound channel and its component chain, while the siHardwareVolume selector applies to the volume of the output device.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996