Multiple bus au initialization using AuBase
Multiple bus au initialization using AuBase
- Subject: Multiple bus au initialization using AuBase
- From: Andrew Simper <email@hidden>
- Date: Tue, 16 Feb 2010 16:29:53 +0000
Can someone please point me to a document describing the chain of events
that happens during audio unit initialization for plugins - especially
ones with multiple buses? A uml sequence diagram would be ideal, but
even just a flowchart or list of function calls would be fine as a
starter.
I have been trying the age old computer methodology of "bashing on
things till they work" without much success. Ignoring multiple
configurations for the moment I have a stereo plugin with external
sidechain, so it has a config which I use the notation "2;2-2" meaning
two stereo input buses and a single stereo output bus. I inherit from
the aubase class and initialize it's constructor with 2 input buses and a
single output bus and override the following:
Since SupportedNumChannels does not take any bus / element
information should it return the maximum total number of inputs and
outputs per config, or the maximum for an individual bus? I've tried
both and neither work. When I use 4-2 auval fails as listed below, and
when I use 2-2 it does pass auval but the second input bus never gets
used and called PullInput returns an error. It seems that AuVal never
sets the second bus to anything other than 2 channels, which is what is
returned from GetInput(1)->NumberChannels (); If I return 0 from
SupportedNumChannels AuVal does indeed start trying out all kinds of
configurations on all buses, but then fails if because I don't support
all possible n-n versions.
Anyone have any ideas on what steps are involved when sublassing
from AuBase to get multiple input buses working?
Here are the
gory details about overridden virtual functions, for the 4 inputs and 2
outputs I do this:
UInt32 SupportedNumChannels (const AUChannelInfo** outInfo)
{
if (outInfo != 0)
{
channelInfo[i].inChannels = 4;
channelInfo[i].outChannels
= 2;
*outInfo = m_channelInfo; // a member variable:
AuChannelInfo m_channelInfo[1];
}
return 1;
}
Then in the initalize
function only accept the "2;2-2" config:
ComponentResult
Initialize()
{
AUBase::Initialize();
int numIns0 = GetInput(0)->NumberChannels();
int
numIns1 = GetInput(1)->NumberChannels(); // this always seems to
return 2 no matter what!
int numOuts0 =
GetOutput(0)->NumberChannels()
;
if ((numIns0 == 2) && (numIns1 == 2) &&
(numOuts0 == 2))
{
TRC("Accepted config:
"<<numIns0<<";"<<numIns1<<"-"<<numOuts0);
prepareToPlay();
return noErr;
}
else
{
TRC("Rejected config:
"<<numIns0<<";"<<numIns1<<"-"<<numOuts0);
return kAudioUnitErr_FormatNotSupported;
}
}
But it seems that auval has a different
understanding of when a bus is "active". Auval loops through only
setting bus/element 0 and leaves input bus/element 1 at 2 channels, but
then says "WARNING: Can Initialize Unit to un-supported num
channels:InputChan:2,
OutputChan:2". I have also overridden the ValidFormat so you can see
which bus/elements are being changed between calls to initialize
(I've not listed the full auval log since the message was too long and needed approval)
All the best,
Andrew Simper
--
cytomic
sound music software
_______________________________________________
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