Question

To stop a mixer bus render callback, one can stop the graph, remove the bus and restart the graph. But I have two requirements:

A. Do not want to stop/re-start the graph.
B. Do not want to remove the mixer bus.

I can disable / enable a specified bus with:

OSStatus result = AudioUnitSetParameter (
                     mixerUnit,
                     kMultiChannelMixerParam_Enable,
                     kAudioUnitScope_Input,
                     inputBus,  //the specified bus number
                     isOnValue,  //on:YES or off:NO
                     0
                  );

But that did not prevent the render callback for the specified bus from getting called. Currently, I do this by using an if statement in the render callback function to filter out that specific bus.

Is there a way to achieve what I try to do? (without using my current solution)

Was it helpful?

Solution

You can modify a node's input while the graph is active. You only need to update the graph afterwards.

To do so, use AUGraphDisconnectNodeInput(...) and afterwards AUGraphUpdate(...).

UPDATE after edit of question:

Your two statements do not do the opposite thing. The first one removes the input from the mixer unit (your callback, i presume) and the second one adds the mixer unit as input for the io unit. The latter one is a connection which probably already exists at that time, because you didn't remove this connection.

You have to attach the render callback again to the mixer unit instead of adding the mixer unit to the io unit.

Also make sure to call AUGraphUpdate after adding the input of the mixer unit to tell the graph to update itself because it was changed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top