How To Determine What Input Bus Is Active When AUEffectBase::Render Is Called?
It's clearly a n00b question, as this has been implemented successfully in applications. But it's 2009 and I'm still unclear how input/output buses work with AUBase.
I'll crib the wording of my question from a post to the coreaudio-api mailing list. This question pops up other times with no answer through 2005.
I was just looking over the AUBase code again, and I'm having trouble seeing how AUBase::Render() is supposed to work in the case of multiple busses (because it doesn't take a bus number argument)...
Here's a quick overview of the method call order:
In the implementation of
AUBase::DoRender(), the local variableoutputis set toGetOutput(inBusNumber).Then the
outputvariable is eventually (after calling the pre-render notify callout) passed toAUBase::DoRenderBus().DoRenderBus()does some buffer preparation ontheOutput, which isoutputpassed in (for the given bus number), and then callsRenderBus(). The output element is not passed along.The default implementation of
RenderBus()callsNeedsToRender()and then ontoRender(), without passing the bus number or output element object.
The comment above AUBase::RenderBus() in AUBase.h says:
Override this method if your AU processes 开发者_如何学Cmultiple output busses completely independently -- you'll want to just call
Renderwithout theNeedsToRendercheck. Otherwise, overrideRender().
To me, the comment above sounds like it's saying that you should do your processing in Render() even if you support multiple busses.
So... if one does his/her processing within Render(), how is one supposed to determine which output element to work with? If you also override RenderBus(), you could store the inBusNumber argument somewhere for use in Render(), but that's just ugly.
As you say, Render does not take a bus-number argument.
virtual OSStatus Render(AudioUnitRenderActionFlags & ioActionFlags,
const AudioTimeStamp & inTimeStamp,
UInt32 inNumberFrames);
I believe this means it should render output for all output busses. It will also fetch input from all input busses.
To determine which input busses exist/are connected/active (not sure what the terminology is) you can call HasInput.
I only tried it with one output bus and several input busses.
加载中,请稍侯......
精彩评论