Modifying this control will update this page automatically
GetParameter function in Scripter MIDI plug-in in MainStage
The GetParameter()
function retrieves information from parameters defined with var
PluginParameters. Parameter variables can include type, minimum and maximum range values, and default values within the defined range, for example. Also see Create Scripter MIDI plug-in controls.
The GetParameter name argument must match the defined PluginParameters name value.
Load the corresponding Tutorial setting to view the script in the Script Editor. This will help you to understand the syntax structure and layout of code and comments. See Use the Script Editor.
Tutorial script 5: Velocity Slider
Text following /* shows comments that explain the JavaScript code.
function HandleMIDI(event) {
event.velocity = GetParameter("Note Velocity");
/* retrieves "Note Velocity" information from the defined "Note Velocity" parameter */
event.send(); /* sends the note event */
}
var PluginParameters = [{name:"Note Velocity", type:"lin", minValue:1, maxValue:127, numberOfSteps:126, defaultValue:80"}];
/* create a linear parameter called "Note Velocity" with a range of 1 to 127, and a default value of 80 */