Previous Book Contents Book Index Next

Inside Macintosh: Sound /
Chapter 5 - Sound Components / Sound Components Reference
Sound Component-Defined Routines / Creating and Removing Audio Sources


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.

SoundComponentAddSource

A sound output device component that can mix multiple channel of audio data must implement the SoundComponentAddSource function to add a new sound source.

pascal ComponentResult SoundComponentAddSource 
                  (ComponentInstance ti, SoundSource *sourceID);
ti
A component instance that identifies your sound component.
sourceID
On exit, a source ID for the newly created source component chain.
DESCRIPTION
The SoundComponentAddSource function is called by the Sound Manager to create a new sound source. If your sound output device component can mix multiple channels of sound, it needs to define this function. Your SoundComponentAddSource function should call the Sound Manager function OpenMixerSoundComponent to create an new instance of the Apple Mixer component. The Apple Mixer component then creates a sound component chain capable of generating the type of data your sound output device component wants to receive.

The Apple Mixer also assigns a unique 4-byte source ID that identifies the new sound source and component chain. You can retrieve that source ID by calling the Apple Mixer's SoundComponentAddSource function. Your SoundComponentAddSource function should then pass that source ID back to the Sound Manager in the sourceID parameter.

IMPORTANT
Most sound components do not need to implement the SoundComponentAddSource function. Only sound components that can handle more than one source of input need to define it.
SPECIAL CONSIDERATIONS
The SoundComponentAddSource function is called at noninterrupt time.

RESULT CODES
Your SoundComponentAddSource function should return noErr if successful or an appropriate result code otherwise.

SEE ALSO
See page 5-33 for a description of OpenMixerSoundComponent.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996