AudioProcessorGraph::addConnection (request)

For my host, when i restore whole settings of an AudioProcessorGraph, and i/o channelconfiguration has changed, i need to know which connections are illegal.
Please add a allowIllegalConnection parameter to the addConnection method, so i can check later for illegal connections, or just hold them, so that they automatically getting reactivated after channel-configuration changed again, please.
The allowIllegalConnection can be a default parameter = false, so it doesn’t have any impact on old code.

bool AudioProcessorGraph::addConnection (const uint32 sourceNodeId,
                                         const int sourceChannelIndex,
                                         const uint32 destNodeId,
                                         const int destChannelIndex, const bool allowIllegalConnection /* = false */ )
    if (  !allowIllegalConnection  &&     !canConnect (sourceNodeId, sourceChannelIndex, destNodeId, destChannelIndex))
        return false;

    GraphRenderingOps::ConnectionSorter sorter;
    connections.addSorted (sorter, new Connection (sourceNodeId, sourceChannelIndex,
                                                   destNodeId, destChannelIndex));

    return true;

Oh, that smells of “hack” to me!

Perhaps you should restore all your nodes and then add their connections afterwards?

ok, if you say its hack, than the current way AudioProcessorGraph handles illegalConnections after the Channel-Configuration changes is also a hack, but it works very good.
If you don’t add these changes, i will need to add another complexity layer for handling connections and something like a channelChanging Listener system, and an internal store for illegal connections, what things make more and more complicated.

For example a AudioProcessorGraph gets stored with a 8in/8out channels. (I use the same input/ouput plugins like in the Audio-Plugin-Host Demo)
Save the project.
Maybe through a misconfiguration the AudioProcessorGraph gets restored with only 2in/2out channels (or even with 0in/0out!!), and than re-saved.
After the graph is restored with the original 8in/8out, 6 connections are missing (or 8 ).
What happens if the number of channels changed while the project is open (its allowed in my app, because the AudioProcessorGraph is connected to the DeviceManager, normal way, like the Plugin Host Demo).
I have to implement a extra structure which detects changes of the channelConfiguration and then reimplement the Connections in the AudioProcessorGraph.

So think i illegal connections should be “ok” (this IS the current situation), they only should be ignored (this IS the current situation) , but there should be the option (the allowIllegalConnection), to create them, to check them after restoring.
This makes a lot of things much easier. (an remember its just an option)

can you have a short look on this, my modification is small and doesn’t break any existing code :slight_smile: :roll: