Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 5 - Sound Components / Sound Components Reference
Sound Manager Utilities / Opening and Closing the Apple Mixer 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.

OpenMixerSoundComponent

A sound output device component can use the OpenMixerSoundComponent function to open and connect itself to the Apple Mixer component.

pascal OSErr OpenMixerSoundComponent 
                        (SoundComponentDataPtr outputDescription, 
                        long outputFlags, 
                        ComponentInstance *mixerComponent);
outputDescription
A description of the data format your sound output device is expecting to receive.
outputFlags
A set of 32 bit flags that provide additional information about the data format your output device is expecting to receive. See "Data Format Flags" beginning on page 5-28 for a description of the constants you can use to select bits in this parameter.
mixerComponent
The component instance of the Apple Mixer component. You need this instance to call the SoundComponentGetSourceData and CloseMixerSoundComponent functions.
DESCRIPTION
The OpenMixerSoundComponent function opens the standard Apple Mixer component and creates a connection between your sound output device component and the Apple Mixer. If your output device can perform specific operations on the stream of audio data, such as channel mixing and rate conversion, it should call OpenMixerSoundComponent as many times as are necessary to create a unique component chain for each sound source. If, on the other hand, your output device does not perform channel mixing, it should call OpenMixerSoundComponent only once, from its SoundComponentInitOutputDevice function. This opens a single instance of the Apple Mixer component, which in turn manages all the available sound sources.

Your component specifies the format of the data it can handle by filling in a sound component data record and passing its address in the outputDescription parameter. The sound component data record specifies the data format as well as the sample rate and sample size expected by the output device component. If these specifications are sufficient to determine the kind of data your component can handle, you should pass the value 0 in the outputFlags parameter. Otherwise, you can set flags in the outputFlags parameter to select certain kinds of input data. For example, you can set the kNoChannelConversion flag to prevent the component chain from converting monophonic sound to stereo sound, or stereo sound to monophonic sound. See "Data Format Flags" beginning on page 5-28 for a description of the constants you can use to select bits in the outputFlags parameter.

SPECIAL CONSIDERATIONS
The OpenMixerSoundComponent function is available only in versions 3.0 and later of the Sound Manager. It should be called only by sound output device components.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996