Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 6 - Audio Components


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.

Summary of Audio Components

This section provides a C summary for the constants, data types, and routines you can use to write an audio component. There are currently no Pascal interfaces available for writing audio components.

C Summary

Constants

/*component types*/
#define kAudioComponentType            'adio'   /*audio component*/
/*subtypes for kAudioComponentType component type*/
#define kAwacsPhoneSubType             'hphn'   /*AWACS phone*/
#define kAudioVisionSpeakerSubType     'telc'   /*AudioVision speaker*/
#define kAudioVisionHeadphoneSubType   'telh'   /*AudioVision headphones*/
#define kAudioCodeType                 'adio'   /*audio component code type*/
/*Component Manager selectors for routines*/
enum {
   kAudioGetVolumeSelect = 0,
   kAudioSetVolumeSelect,
   kAudioGetMuteSelect,
   kAudioSetMuteSelect,
   kAudioSetToDefaultsSelect,
   kAudioGetInfoSelect
};
/*values for whichChannel parameter*/
#define audioAllChannels         0        /*all channels*/
#define audioLeftChannel         1        /*left channel*/
#define audioRightChannel        2        /*right channel*/
/*values for mute parameter*/
#define audioUnmuted             0        /*device is not muted*/
#define audioMuted               1        /*device is muted*/
/*audio component features flags*/
#define audioDoesMono                  (1L<<0)  /*supports mono output*/
#define audioDoesStereo                (1L<<1)  /*supports stereo output*/
#define audioDoesIndependentChannels   (1L<<2)  /*supports independent 
                                          software control of each channel*/

Data Types

Short Fixed-Point Numbers

typedef short ShortFixed;

Audio Information Record

typedef struct {
   long           capabilitiesFlags;   /*device capabilities*/
   long           reserved;            /*reserved*/
   unsigned short numVolumeSteps;      /*number of volume steps*/
} AudioInfo, *AudioInfoPtr;

Audio Component-Defined Routines

Getting and Setting Volumes

pascal ComponentResult AudioGetVolume
			(ComponentInstance ac, short whichChannel, ShortFixed *volume);
pascal ComponentResult AudioSetVolume
			(ComponentInstance ac, short whichChannel, ShortFixed volume);

Managing the Mute State

pascal ComponentResult AudioGetMute
			(ComponentInstance ac, short whichChannel, short *mute);
pascal ComponentResult AudioSetMute
			(ComponentInstance ac, short whichChannel, short mute);

Resetting Audio Components

pascal ComponentResult AudioSetToDefaults
			(ComponentInstance ac);

Getting Audio Component Information

pascal ComponentResult AudioGetInfo
			(ComponentInstance ac, AudioInfoPtr info);

Assembly-Language Summary

Data Structures

Audio Information Record
0capabilitiesFlagslongdevice capabilities
4reservedlongreserved
8numVolumeStepswordnumber of volume steps


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996