Creating and using modulation bus with juce audioprocessorgraph

inspired by this

post about using a processor graph to send around audiorate modulation I’m trying to implement it myself. first trying to figure how to interact with a modulation bus through the Node or AudioProcessor API.

do buses just get slapped on the end of the channel index for a node?
for example I have my bus layout set as such

            .withOutput ("Output1", juce::AudioChannelSet::stereo(), true).
            withInput ("Modulation",juce::AudioChannelSet::discreteChannels(1) ,false); 

since I have no input is the modulation bus channel index 0 for my connection?

Yep – since it’s just a single IO it will probably just make a single channel buffer and you overwrite the input and replace it with the output.

thanks for the quick follow up! I also confirmed this is the behavior. I actually end up with a setup that looks like this

 .withOutput ("Output1", juce::AudioChannelSet::stereo(), true)
                .withInput("input",juce::AudioChannelSet::mono(),false)
            .withInput ("Modulation",juce::AudioChannelSet::discreteChannels(10) ,true);

for some reason (safety I guess) you can’t add a bus with the juce::AudioChannelSet::disabled() type so I burn a mono channel and set it as not enabled to indicate to the gui that it won’t have audio input.

also important to note for Anyone who stumbles upon this idea in the future are the functions getBusBuffer and getChannelIndexInProcessBlockBuffer which do what they say and get the properly offset channel so that you can change your bus layout and still know where your bus is

this brings me to my other question. is there no way to access buffers by name?

would make sense for my “host” to be querying a processor for its bus information by name rather than enforcing an arbitrary index on the modulation buffer

Individual channels don’t have names. You can call AudioProcessor::getBus() to query specific buses, and Bus::getName to find the name of each bus. For the channels in the bus, once you know the AudioChannelSet of the bus, then you can use AudioChannelSet::getTypeOfChannel (channelIndex) to find out what kind of channel is at each index.

Yeah unfortunately not – you’d need to define a set of enums / functions separate which map to each type of node.

1 Like