On Nov 3, 2005, at 11:29 PM, john smith wrote:
void AU::AUKernel::Process
[skip]
sourceP += inNumChannels; // advance to next frame (e.g. if stereo, >we're advancing 2 samples);
[skip]
But... inNumChannels is always 1 we're told. So, what's happening in the stereo case?
A bit of history here...... The AU specs define a "native" format that every "normal" AU is expected to provide on any output bus and to receive on any input bus. By "normal" AU I mean an AU which is not a HAL InputAU (these ones are a special family intended to simplify the management of an audio device). Originally - ie for V1 AU - the native format was 32 bit interleaved float. V1 AU are now deprecated and replaced by V2 AU for which the native format is 32 bit *NON* interleaved float. The Kernel class is there to provide a basic mechanism for n:n AU, ie same number of channels on input and output busses. The code executed before the call to AU::AUKernel::Process() - in AUEffectBase::ProcessBufferLists() - separate channels wether they are part of an interleaved or non interleaved stream (ie wether your AU is V1or V2) and allows your code to process channels independently.
Within CoreAudio, audio stream data are passed around using the 'AudioBufferList' structure:
struct AudioBufferList
{
UInt32 mNumberBuffers;
AudioBuffer mBuffers[kVariableLengthArray];
};
which had to be used in a consistent way in a V1 or V2 world. In V1 world, an AudioBufferList contains one AudioBuffer (mNumberBuffers = 1) made of a number of n Float32 frames for an interleaved n channels stream. In V2 world, an AudioBufferList contains n AudioBuffer (mNumberBuffers = n) made of a number of 1 Float32 "frames" for a non interleaved n channels stream. The 'inNumChannels' parameter passed to AU::AUKernel::Process() refer to the number of Float32 samples in a frame, that is 'n' for the V1 case (interleaved), and 1 for the v2 case (non interleaved). It is the copy of the AudioBuffer::mNumberChannels field. In other words, 'inNumChannels' is the number of interleaved channels in an AudioBuffer.
Finally, what's the ioSilence parameter for?