Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 5 - Sound Components / Writing a Sound Component


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.

Specifying Sound Component Capabilities

As mentioned in the previous section, the componentFlags field of a component description for a sound component contains bit flags that encode information about the component. The high-order 8 bits of that field are reserved for use by the Component Manager. In those 8 bits, you can set the cmpWantsRegisterMessage bit to indicate that the Component Manger should call your component during registration.

The low-order 24 bits of the componentFlags field of a component description are used by the Sound Manager. You'll set some of these bits to define the capabilities of your sound component. You can use the following constants to set specific bits in the componentFlags field.

#define k8BitRawIn               (1 << 0)    /*data flags*/
#define k8BitTwosIn              (1 << 1)
#define k16BitIn                 (1 << 2)
#define kStereoIn                (1 << 3)
#define k8BitRawOut              (1 << 8)
#define k8BitTwosOut             (1 << 9)
#define k16BitOut                (1 << 10)
#define kStereoOut               (1 << 11)
#define kReverse                 (1 << 16)   /*action flags*/
#define kRateConvert             (1 << 17)
#define kCreateSoundSource       (1 << 18)
#define kHighQuality             (1 << 22)   /*performance flags*/
#define kRealTime                (1 << 23)
These constants define four types of information about your sound component: the kind of audio data it can accept as input, the kind of audio data it can produce as output, the actions it can perform on the audio data it's passed, and the performance of your sound component. For example, a utility component that accepts only monaural 8-bit, offset binary data as input and converts it to 16-bit two's complement data might have the value 0x00000801 (that is, k8BitRawIn | k16BitOut) in the componentFlags field.

The Sound Manager also defines a number of masks that you can use to select ranges of bits within the componentFlags field. See "Sound Component Features Flags" on page 5-26 for complete information on the defined bit constants and masks.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996