Scripter Javascript Tutorial
javascriptmusiclogicscripterbookexcerpttutorial71 Get Values from Controls
To get the value of any control, use the global
GetParameter()
function, which returns the data type
appropriate for the kind of control.
var PluginParameters = [];
.push({name:"Linear Slider 1", type:"lin", unit:"%", minValue:0, maxValue:100, numberOfSteps:100, defaultValue:50});
PluginParameters
function HandleMIDI(event) {
var value = GetParameter("Linear Slider 1");
Trace(value);
}
***Creating a new MIDI engine with script***
Evaluating MIDI-processing script...
Script evaluated successfully!
50
...
>
In the above example, as the track plays and the parameter control
changes, then the updated value is returned every time the
HandleMIDI()
or ProcessMIDI()
functions are
called.
GetParameter()
has to be called from within
HandleMIDI()
or ProcessMIDI()
, never in the
global scope, or Scripter will throw the following error in the console
upon clicking the Run Script button:
***Creating a new MIDI engine with script***
Evaluating MIDI-processing script..GetParameter() called with an argument: (Linear Slider 1) that does not equal any registered parameter name.
Script evaluated successfully!
undefined
>