As this post is about a script, I have deleted it from the previous topic and moved it to this section.
With a lot of difficulty because I don’t understand anything about scripts, I succeeded in creating an “ON/OFF” button to make or not the script running on rackspace activation.
I have also tried to create a “TIME” widget to select the duration of the fade-in, but I did not succeed in applying it to the SetGeneratorLength() function which seems to only accepts an integer…
Is is there a way to do this ?
Here is the script with some lines where I tried to insert timing elements but unfinished.
And the gig file
Auto Fade-In .gig (82.4 KB)
Var AUTO : Widget // A button widget USED TO ENABLE THE RAMP TIME : Widget // A knob widget USED TO SET THE GENERATOR LENGHT GAIN : Widget // A knob widget used to trigger the ramp myRamp : Ramp // A generator that moves smoothly from 0.0 to 1.0 over some specified time StartValue : double // This remembers the initial value of the knob so that when we start again // the knob will be reset to this value Timevalue : double Running : Boolean // Keep track of whether we are currently running the ramp initialization SetGeneratorOneShot(myRamp, true) // Generator will only run once when triggered myRamp.SetGeneratorLength(5000); // MILLISECONDS ONLY??? End On Activate // A new rackspace is selected StartValue := GetWidgetValue(GAIN) // Get the initial level of the knob (NB make sure it's not already 0 // otherwise nothing will happen Timevalue := GetWidgetValue(TIME) End On WidgetValueChanged(newValue : double) from AUTO If newValue > 0.1 then myRamp.EnableGenerator(True) // Arm the ramp function generator SetTimersRunning(true) // The ramp function generator will now start producing values End End On TimePassing(timeX : integer, amplitudeY : double) from myRamp // This gets called by the ramp generator as time passes SetWidgetValue(GAIN, StartValue + StartValue *70 *amplitudeY) // start value = 0.1 *70 to reach end value = 70 End
(formatted the code as “code” for better readability - schamass as Mod)