In principle with three instances of Cabbage running, identified to JACK as Cab0, Cab1 and Cab2 I can use Cab0 to take its input from the sound card (system) ports capture_1 and capture_2 and drive ports (DACs) system playback_3 and playback_4. This works fine, such as using a reverb in this instance.
My second instance Cab1 is running a distortion file Powershape.csd and I can make it work in a similar way. However, when I try to use the JUCE audio port selector (Edit > Settings > Audio and MIDI > Input and so Active input channels) to get the input from the output of Cab0, it seems that the JUCE selector is not behaving as I expect. I can set "Input:" to "Cab0", leaving "Output:" as "system" and "Active output channels:" with just "playback_7 + playback_8" ticked (which works fine for output), but it is clear that my selections, supposedly for Cab0 ports, are actually selecting from the system (sound card) ports. This is clear from the behaviour and from the names of the ports, which are those of "system" and not of "Cab0".
So it seems that with this JUCE library Cabbage is incapable of selecting its input from a different JACK device than the one it sends it output to.
For instance, if "Output:" is set to "ardour" then it doesn't matter what "Input:" is set to - all the ports shown in "Active input channels:" are from Ardour
Yet when I set both "Output:" and "Input:" to Cab0, I am unable to select any ports at all in "Active input channels:".
I guess this is due to one or more bugs in JUCE which cannot be rectified in Cabbage.
My workaround, to get the output of Cab0 into Cab1, is to use Ardour mixer strips (and so recording channels) 1 and 2 and set their inputs to Cab0 3 and 4 respectively.
I can do something similar, without using up a pair of valuable ports on the sound card, by making Cab0's output go to some sound card port I don't care about, in this case "playback_35 + playback_36". There's no ADC/DAC on those ports. I can see the output signal on hdspmixer. Then, in Ardour, I use mixer strips 1 and 2, setting their inputs to Cab0's out_35 and out_36 respectively.
I set Cabbage1 to have its inputs and outputs from the sound card (system) and selected 35 and 36 for the inputs and outputs. There is nothing plugged into the SPDIF input of the sound card, so Cabbage1 will get silence from these. It doesn't matter what is sent to SPDIF out.
In the post-fader sections of these Ardour mix strips 1 and 2 I added two New External Sends. Strip 1's L went to Cab1 35 and Strip 2's R went to Cab1 36. (A similar outcome could be achieved with a two channel mixer strip.) I can see these signals are present by the little bar graph indicator to the right of Cabbage Settings > Audio and MIDI > "Input". Then I set up Ardour mix strips 3 and 4 to get their inputs from Cab1 35 and 36 respectively. I could direct their outputs of mixer strips 3 and 4 to the Master bus and listen to them on some other sound card channels.
Now I set up Cabbage2 with exactly the same inputs and outputs as Cabbage1 - the unused soundcard ports 35 and 36. It doesn't matter what they output there, and the inputs Cabbage2 gets are silent except for me adding to Ardour strips 3 and 4 two post-fader External Sends to Cab2 35 and 36. I can play the same game, using strips 6 and 7 to get the outputs of Cabbage2 and listen to them with the Master bus.
Patching Cabbage instances together and in combination with Ardour mix strips and sound card inputs and outputs requires that Cabbage be able to input audio from a different JACK device than it sends its output to. In my experience the current JUCE audio port selector can't do this, so it suffices to make one or more instances of Cabbage use silent sources (including perhaps silent output busses from Ardour, rather than using a sound card channel) including the same source and driving their outputs to something similar, which doesn't matter. Then, the patching can be done with ordinary inputs and with External Sends in the Ardour mixer strips.
I think the same arrangements can be used with an insert in the Processor section of the Ardour mix strips - sending audio, one or more channels, directly to whatever instance of Cabbage I like and getting its outputs back into the same mixer strip.
It seems that JUCE opening 39 audio ports is due to 32 + 2 + 2 audio ports and 3 MIDI ports on the sound card. It does not allow ticks on the ports MIDI ports.
I recall that Cabbage sets up JUCE for two audio inputs and two audio outputs. I will be able to change this when I make .CSD files for more than two channels.
If there are two or more output ports selected (more than one tick) I have observed that JUCE sends Cabbage's output to the lowest number port with a tick, rather than to all of those which are ticked.
For conventional audio processing it might be easier to just line up a bunch of plugins. However, with this scheme, I am not reliant on plugins. All the work is done by Csound files, with Cabbage's marvelous real-time GUI controls. I can write Csound and I can use C/C++ to write Csound ugens, so this scheme provides tremendous flexibility and opportunity for fun!