Re: Multiple bus au initialization using AuBase
Re: Multiple bus au initialization using AuBase
- Subject: Re: Multiple bus au initialization using AuBase
- From: William Stewart <email@hidden>
- Date: Tue, 16 Feb 2010 17:59:43 -0800
On Feb 16, 2010, at 8:29 AM, Andrew Simper wrote:
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.
You have the code. You can step through this. anyway... moving on.
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
ok
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?
per bus. So, in the example you cited, if that was all your AU does,
you need { 2, 2 }
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
by who? Just because the bus is there doesn't mean that it will have
something connected to it. In your AudioUnit's render method it is up
to you how you get the input (if connected). Typically, what you will
do is go through the inputs you have, see if they have a connection
(or callback) and if so, PullInput.
and called PullInput returns an error.
ok - so nothing is connected to it. that's the other way to find out -
just skip this input.
It seems that AuVal never sets the second bus to anything other than
2 channels,
sure - you told auval that {2, 2} is all your AU supports, so that's
fine.
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.
ok - so that seems fine. Except that "0" is not a valid value to
return - it means you don't have any input channels at all.
Anyone have any ideas on what steps are involved when sublassing
from AuBase to get multiple input buses working?
ok - so firstly auval is a command line tool to validate the semantics
of the AU API. It is not a test tool to test different AU features.
If you want to actually test this, I would:
build this for {2, 2}
make sure it passes auval
run AULab and you can connect a sidechain to the 2nd input
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;
}
This is not the way we think about this. What you are saying here is
that you want each input bus to have 4 channels, and each output bus
to have 2 channels.
Then in the initalize function only accept the "2;2-2" config:
now you have just confused everyone and your au will fail validation
because you are looking for 2 channels on each bus, but told it you
wanted 4. I don't understand why you would do this when you first said
above that you had published {2, 2} and it worked...
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;
}
}
this is correct if you use {2, 2}
But it seems that auval has a different understanding of when a bus
is "active".
you are conflating a bus being present and bus being used - these are
different concepts.
Bill
_______________________________________________
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