AudioProcessorGraph - Adding Node Question

Hi Jules,

I was simply wondering if “AudioProcessorGraph::addNode” was designed to allow adding a processor multiple times?

If not, should there be a check for such a situation in that method?

No, each node in a graph needs to be unique, but it looks like there’s already an assertion to check for that.

But, it’s checking for a node ID, not a processor… Which means there’s wiggle room for adding the same processor multiple times with an unspecified node ID (ie: an ID of 0).

I think the node IDs are all supposed to be unique…

1 Like

Okay, so you are allowed to add the same processor twice:

AudioProcessorGraph graph;
MyProc* proc (new MyProc());

graph.addNode (proc); //nodeID is 0 by default - graph added new Node with ID 1
graph.addNode (proc); //nodeID is 0 by default - graph added new Node with ID 2

Thus causing a dangling pointer deletion later on.

Ah yes, I forgot that it’d generate a new ID for you… Thanks, yes, will add an assertion for that.

Thanks Jules :slight_smile: