Okay so I finally get the idea how "NamedControls" are workin'. This makes it a lot more flexible and prettier. So this is how I implemented my global reverb bus and made it more scalable. These are my SynthDefs that I use:
var numChannels = ~dirt.numChannels;
SynthDef(\valhalla2, {|out|
var size = 14; // Works for 14 orbits -> this value needs to be fixed in a UGen
var dryBusses = NamedControl.kr(\dryBusses, (0 ! size ));
var wetReverbs = NamedControl.kr(\wetReverbs, (0 ! size));
var fxSound = size.collect({arg i; In.ar(dryBusses[i], numChannels) * wetReverbs[i]}).sum;
fxSound = VSTPlugin.ar(fxSound, numOut: numChannels, id: \valhalla);
Out.ar(out ,fxSound);
}).add;
SynthDef(\masterSynth, { |out, fxBus|
var size = 14;
var wetSound = In.ar(fxBus, numChannels);
var dryBusses = NamedControl.kr(\dryBusses, (0 ! size ));
var wetSums = NamedControl.kr(\wetSums, (0 ! size));
var drySound = size.collect({
arg i;
ReplaceOut.ar (dryBusses[i], In.ar(dryBusses[i], numChannels) * (1/(wetSums[i] +1) ));
});
Out.ar(out, wetSound);
}).add;
Basically I added a master Synth to write the sum of i.e. three fx busses and write them to my output bus (so to say I replace all audio signals on my hardware output with my global fx bus signal and reduce the gain of my dry sounds respectively).
And this is how I initialize it:
var numChannels = ~dirt.numChannels;
var masterBus = Bus.new;
var globalReverbBus = Bus.audio(~dirt.server, ~dirt.numChannels);
var wetReverbs = Array.fill(~dirt.orbits.size, 0);
var wetSums = Array.fill(~dirt.orbits.size, 0);
var dryBusses = ~dirt.orbits.collect({arg item; item.dryBus});
~valhallaSynth = Synth(\valhalla2, [
\out, globalReverbBus,
id: \valhalla
], addAction: 'addToTail');
~valhallaSynth.set(\dryBusses, dryBusses);
~valhalla = VSTPluginController(~valhallaSynth, id: \valhalla);
~valhalla.open("ValhallaSupermassive.vst3");
~masterSynth = Synth(\masterSynth, [
\out, masterBus,
\fxBus, globalReverbBus,
], addAction: 'addToTail');
~masterSynth.set(\dryBusses, dryBusses);
~dirt.receiveAction = { |event|
var e = event.copy;
var orbit = ~dirt.orbits[e.at(\orbit)];
var reverb = e.at(\reverb) ?? orbit.defaultParentEvent.at(\reverb);
var wet = reverb;
wetReverbs.put(orbit.orbitIndex, reverb);
wetSums.put(orbit.orbitIndex, wet);
~valhallaSynth.set(\wetReverbs, wetReverbs);
~masterSynth.set(\wetSums, wetSums);
};
So maybe this is helpful for someone or I would be glad of having a discussion about this.