Managing AudioProcessorGraph connections

I'm working on a software that needs to manage complex connections between AudioProcessors in a AudioProcessorGraph.

I've read the API doc for AudioProcessorGraph a few times, and there's some things I can't figure out.

There's removeConnection (int index) and getConnection (int index) functions, but how can I get the index of a Connection?

The OwnedArray<Connection> connections is a private member of AudioProcessorGraph, and I can't find any elegant way to access it. There's obviously no getAllConnections() function that would return this array.

I need to create functions such as getConnectionsForNode that would return an array of indexes or Connection*. Or a getConnectionsBetween, without specifing channels. It would be pretty easy if I could search the OwnedArray<Connection> in some way...

The idea is not to manage Connection pointers outstide of the Graph, i would still use the Graph procedures to remove/add connections.

The only way I found for now is either to kind of mirror every connections and disconnections with my own data structure, or to hack the AudioProcessorGraph class to make my class a friend, wich is pretty bad...

But maybe I'm missing something.

 

​Anyone got any insights one this? Maybe it was covered in other posts and I did'nt found them?

 

 

Hmm... do you really need to know that? You know your Audioprocessors, obviously. And most possible you know how you have connected them together, assuming you didn't do it randomly. Cant you just do

removeConnection (AudioprocessorNode1.nodeID, sourceChannelIndex, AudioprocessorNode2.nodeID, destChannelIndex)?

Or am I missing something....
 

Yes, it's what I'm doing actually.

But knowing the AudioProcessors is not enough, I need to keep track of connections. So each time I add a connection to the Graph, I create my own Connection object that I add to an Array. So i kind of duplicate what the AudioGraph already does internally. Then, I can't realy call disconnectNode or removeNode without somehow loosing the correlation between my array of Connections and the one of the Graph. So I need to implement a function that is obviously duplicating some functions of the AudioProcessorGraph to keep track of Connections.

But yes, it works. Does'nt seem optimized at all though.