Reputation: 1523
I have a render callback with 20 buses routed to a mixer and need to apply an effect to only some of these buses.
Do I need different callbacks for this or I can get it with the same render ?
Upvotes: 0
Views: 60
Reputation: 4955
There are a few ways to do this.
You can manually add effects in-between your mixer and your callbacks. So instead of setting the callback on the mixer input directly, you would create an effect unit for each bus that needs it, connect the effect to the mixer input, then set the input callback on the effect. (Most straightforward)
Example:
AUGraphConnectNodeInput(inGraph, sourceEffect, inSourceOutputNumber, mixerNode, inDestInputNumber);
AUGraphSetNodeInputCallback (inGraph, sourceEffect,0,&inputCallbackStruct);
You can keep a reference to each effect, then within your callback manually call AudioUnitRender on the effect. (Kind of complicated)
If you wish to use a single effect for this processing across multiple busses, you could use two mixers. All the busses that need effect would be routed to the "Effect Mixer", then the effect can be on the output of the "Effect Mixer", and the output of the effect can go to your main mixer. (Most efficient)
Upvotes: 1