AudioProcessorGraph - Adding Node Question


#1

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?


#2

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


#3

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).


#4

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


#5

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.


#6

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


#7

Thanks Jules :slight_smile: