Controlling multiple modulators
The more I play with HISE the more I think you're a genius. Just started playing with the Modulator Connection Wizard, very helpful! I'm working on an instrument with 3 samplers, each has an ADSR, I've put a set of 4 knobs on the container's interface to control the ADSRs of each of the samplers. Currently I'm entering one line for each parameter of each sampler's envelope:
if(number == sliA) normalPluckedADSR.setAttribute(normalPluckedADSR.Attack, value); ```but I wondered is there a better way to do this? is it possible to run a loop through all of the envelopes? Something like this pseudo code
sampler.envelope.attack = attack_knob
sampler.envelope.decay = decay_knob
sampler.envelope.sustain = sustain_knob
sampler.envelope.release = release_knob
You could store all modulators in an array and then use a for loop to iterate over them.
Check out this patch:
It contains of two sine generators with one envelope each and a switch statement in the control callback. The attack is controlled by directly calling each Modulator and the release is controlled using a loop statement. For your case I'd strongly recommend using the direct method.
Also, did you check out the global modulator system? It doesn't work for envelope types (way too complicated to explain here), but voice start modulators and time variant modulators can be added once as global modulator and send their modulation value to its receivers which can be placed anywhere. Then you'll need to only control one modulator, which is incredibly useful for stuff like global velocity curves etc.
I was thinking an array would be the way to go. I didn't know switch statements had been implemented. I remember you wrote in the manual about these not being part of JUCE, I'm glad you've added them though, very useful.
I noticed a little (possible) bug with the envelope. When I set the release time to 0ms via a control on the interface the actual release knob of the envelope only goes down to 1ms