Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 5 - Sound Components / Sound Components Reference
Sound Component-Defined Routines / Managing Sound 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.

SoundComponentSetOutput

A sound output device component can call the SoundComponentSetOutput function of the Apple Mixer to indicate the type of data it expects to receive.

pascal ComponentResult SoundComponentSetOutput 
                           (ComponentInstance ti, 
                              SoundComponentDataPtr requested, 
                              SoundComponentDataPtr *actual);
ti
A component instance that identifies your sound component.
requested
A pointer to a sound component data record that specifies the type of the data your component expects to receive.
actual
This parameter is currently unused.
DESCRIPTION
The Apple Mixer's SoundComponentSetOutput function can be called by a sound output device component to specify the kind of audio data the output device component wants to receive. The Apple Mixer uses that information to determine the type of sound component chain it needs to construct in order to deliver that kind of audio data to your sound output device component. For example, if your sound output device is able to accept 16-bit samples, the Sound Manager doesn't need to convert 16-bit audio data into 8-bit data.

The following lines of code illustrate how the sound output device component for the Apple Sound Chip might call Apple Mixer's SoundComponentSetOutput function:

myDataRec.flags = 0;                /*ignored here*/
myDataRec.format = kOffsetBinary;   /*ASC needs offset binary*/
myDataRec.sampleRate = rate22khz;   /*ASC needs 22 kHz samples*/
myDataRec.sampleSize = 8;           /*ASC needs 8-bit data*/
myDataRec.numChannels = 2;          /*ASC can do stereo*/
myDataRec.sampleCount = 1024;       /*ASC uses a 1K FIFO*/
myErr = SoundComponentSetOutput(mySource, &myDataRec, &myActual);
In general, however, a sound output device component shouldn't need to call the Apple Mixer's SoundComponentSetOutput function. Instead, it can indicate the type of data it expects to receive when it calls the OpenMixerSoundComponent function. The SoundComponentSetOutput function is intended for sophisticated sound output device components that might want to reinitialize the Apple Mixer.

IMPORTANT
Only the Apple Mixer component needs to implement this function.
RESULT CODES
The Apple Mixer's SoundComponentSetOutput function returns noErr if successful or an appropriate result code otherwise.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996