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.
The Data Stream
A sound component is a standalone code resource that performs some signal processing function or communicates with a sound output device. All sound components have a standard programming interface and local storage that allows them to be connected together in series to perform a wide range of audio data processing tasks. As previously indicated, all sound components (except for mixer components and some sound output device components) accept a single stream of input data and produce a single stream of output data.The Sound Manager sends your sound component information about its input stream by passing it the address of a sound component data record, defined by the
SoundComponentData
data type.
typedef struct { long flags; /*sound component flags*/ OSType format; /*data format*/ short numChannels; /*number of channels in data*/ short sampleSize; /*size of a sample*/ UnsignedFixed sampleRate; /*sample rate*/ long sampleCount; /*number of samples in buffer*/ Byte *buffer; /*location of data*/ long reserved; /*reserved*/ } SoundComponentData, *SoundComponentDataPtr;Thebuffer
field points to the buffer of input data. The other fields define the format of that data. For example, the sample size and rate are passed in thesampleSize
andsampleRate
fields, respectively. A utility component should modify the data in that buffer and then write the processed data into an internal buffer. Then it should fill out a sound component data record and pass its address back to the Sound Manager, which will then pass it on to the next sound component in the chain. Eventually, the audio data passes through all utility components in the chain, through the Apple Mixer and the sound output device component, down to the audio hardware.