Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 6 - Audio Components / Audio Components Reference
Audio Component-Defined Routines / Getting and Setting Volumes


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.

AudioGetVolume

An audio component can implement the AudioGetVolume function. The Sound Manager calls this function to determine the current volume of an audio port.

pascal ComponentResult AudioGetVolume (ComponentInstance ac,
                                          short whichChannel, 
                                          ShortFixed *volume);
ac
A component instance that identifies your audio component.
whichChannel
The channel or channels whose volume you should return.
volume
On output, the current volume level of the specified channel.
DESCRIPTION
Your AudioGetVolume function is called by the Sound Manager to determine the current volume levels of one or more channels of an audio port. The volume parameter can have any value between 0 and 1, where 0 indicates minimum volume and 1 indicates maximum volume. The whichChannel parameter indicates the channels or channels whose volumes you should return. The following constants are defined for the whichChannel parameter:

#define audioAllChannels         0        /*all channels*/
#define audioLeftChannel         1        /*left channel*/
#define audioRightChannel        2        /*right channel*/
RESULT CODES
Your AudioGetVolume function should return noErr if successful or an appropriate result code otherwise. In particular, if your audio component doesn't support software control of volume levels, AudioGetVolume should return unImpErr.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996