English 中文(简体)
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:

  1. In the implementation of AUBase::DoRender(), the local variable output is set to GetOutput(inBusNumber).

  2. Then the output variable is eventually (after calling the pre-render notify callout) passed to AUBase::DoRenderBus().

  3. DoRenderBus() does some buffer preparation on theOutput, which is output passed in (for the given bus number), and then calls RenderBus(). The output element is not passed along.

  4. The default implementation of RenderBus() calls NeedsToRender() and then onto Render(), 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 multiple output busses completely independently -- you ll want to just call Render without the NeedsToRender check. Otherwise, override Render().

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.





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签