RE: Audio Units - newbie questions
RE: Audio Units - newbie questions
- Subject: RE: Audio Units - newbie questions
- From: "Muon Software Ltd - Dave" <email@hidden>
- Date: Wed, 12 Oct 2005 13:36:52 +0100
- Importance: Normal
> > uint numOutputBusCount = Outputs().GetNumberOfElements();
> > uint channelSoFar = 0;
> > for (uint i = 0; i < numOutputBusCount ; i++)
> > {
> > AUOutputElement *output = GetOutput(i);
> > AudioBufferList &outputBufferList = output->PrepareBuffer(nFrames);
> > AUBufferList::ZeroBuffer(outputBufferList);
> >
> > uint channelCount = outputBufferList.mNumberBuffers;
> > for (uint j = 0; j < channelCount ; j++)
> > {
> > m_ptrAudioBuffers[channelSoFar+j] =
> > reinterpret_cast<float*>(outputBufferList.mBuffers[j].mData);
> > }
> > channelSoFar += channelCount ;
> > }
There's a downside to doing things this way. If a host doesn't support
multiple outputs and only gives us one bus to render onto, we'll have 6
pointers that are still null in m_ptrAudioBuffers at the end of this loop.
This is why I try to work out how many busses I've been given and come up
with a way of filling all eight pointers that I need:
one bus, one buffer = set all pointers I pass to the synth to that buffer
one bus, two buffers = do pointers in pairs - pointers 0,1 = buffers 0,1
then pointers 2,3 = buffers 0,1 etc.
two busses = not supported
three busses = not supported
four bussses, one buffer in each bus = do pointers in pairs - pointers 0,1 =
bus 1 buffer 1, pointers 2,3 = bus 2 buffer 1 etc.
four bussses, two buffers in each bus = do pointers in pairs - pointers 0,1
= bus 1 buffer 1 and buffer 2, pointers 2,3 = bus 2 buffer 1 and buffer 2
etc.
Since my synth accumulates on its buffers, if multiple outputs aren't
supported in the host it won't matter what output the user assigns in the
GUI, the sound will still get mixed onto a host buffer that is heading for
an output. In the mono case, each of my stereo pairs will get mixed into
those mono buffers.
Now I'm really not sure if I'm ever likely to get four busses with one
buffer in each bus. I'm pretty sure I'm likely to get one buss with one
buffer though if the plugin is loaded as mono in Logic.
Regards
Dave
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden