@Rognvald No problem 🙂
This is a bit cleaner:
inline function onButton6Control(component, value)
{
if (!value) { return; } // works the same as if (value) but the scope is a little bit cleaner
local Knob1_value = Math.randInt(20, 20000); // this is already fine
local Knob3_value = Math.random(); // you don't need range here, Math.random() is already within the range you're expecting
Knob1.setValue(Knob1_value); Knob1.changed(); // these can be single lines if you prefer
Knob3.setValue(Knob3_value); Knob3.changed();
};
Content.getComponent("Button6").setControlCallback(onButton6Control);
If Knob1 and Knob3 already have their own Control Callbacks, you also don't need to independently call these:
SimpleGain1.setAttribute(SimpleGain1.Gain, Knob1_value); // already handled by Knob1.changed();
SimpleGain2.setAttribute(SimpleGain2.Gain, Knob3_value); // already handled by Knob3.changed();
Control.changed() is essentially simulating changing the control with the mouse, so you're basically calling the setAttribute function twice.