Re: Quick question on configuring an AU for a certain channel config
Re: Quick question on configuring an AU for a certain channel config
- Subject: Re: Quick question on configuring an AU for a certain channel config
- From: "Sophia Poirier [dfx]" <email@hidden>
- Date: Wed, 5 Dec 2007 17:54:45 -0500
On Dec 5, 2007, at 8:13 PM, tahome izwah wrote:
Now I am left wondering how I declare two of the 4 input channels to
be a side chain. Any ideas or pointers to relevant documentation on
the Apple web site? I managed to download the "Audio Unit Programming
Guide" but it doesn't cover how to set up a side chain in an AU...
:-((
To add to what Bill said, if you're making an effect AU and would
rather still inherit from AUEffectBase rather than going down to
AUBase (in order to pass the buss count arguments to its
constructor), it's also possible to add an extra busses to an
AUEffectBase-derived AU. To do that, in your constructor you'll want
to first call CreateElements() before doing anything with busses, and
then after that you can do this:
SetBusCount(kAudioUnitScope_Input, 2);
Note that, if you're adding additional busses, you'll want to name
them for the sake of the host being able to provide an interface to
the user for differentiating them. You can do that next something
like this:
GetElement(kAudioUnitScope_Input, 0)->SetName(CFSTR("main input"));
GetElement(kAudioUnitScope_Input, 1)->SetName(CFSTR("sidechain
input"));
Note that SafeGetElement() can return null, so you should add
appropriate safety measures around those calls (which I left out of
my quicky example snippet).
Then in order to access that additional element, you'll want to
override the AUBase::Render() method and do something like this to
start with:
OSStatus status = noErr;
AudioBufferList * sidechainBufferList = NULL;
bool sidechainIsAvailable;
try { sidechainIsAvailable = HasInput(1); }
catch (...) { sidechainIsAvailable = false; }
if (sidechainIsAvailable)
{
AUInputElement * theSidechainInput = GetInput(1);
if (theSidechainInput != NULL)
{
status = theSidechainInput->PullInput(ioActionFlags, inTimeStamp,
1, inNumFramesToProcess);
if (status == noErr)
sidechainBufferList = &(theSidechainInput->GetBufferList());
}
}
if (sidechainBufferList != NULL)
{
// etc...
}
All of the buss handling stuff in the AU SDK is fairly non-obvious in
my opinion and kinda difficult to get an overall handle on, so
hopefully this helps some to start with...
Sophia
p.s. - The fact that AUBase::HasInput() doesn't really return false
for a "no" answer so much as it throws an exception is kinda
ridiculous in my opinion; I think I shall go file a bug on that...
_______________________________________________
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