3.5

Table Of Contents
204MainStage Effects
MainStage Scripter MIDI plug-in SetParameter function
The SetParameter() function allows you to programmatically set the value of a control.
Usage is similar to the MainStage Scripter MIDI plug-in GetParameter function, but you
need to add a second argument for the value you want to set.
The first argument describes which parameter is accessed. This can be either an
integer (index) or a string (parameter name).
The second argument is the value that you want to set (this is always a number).
Important: Using SetParameter and track automation for a parameter at the same time can
lead to unexpected behavior. You can circumvent such problems by disabling automation
for each parameter.
Code use example
The example code creates a slider control and resets the value of that slider to 0 each time
the plug-in is reset.
Note: You can opt out of automation on a per-parameter basis by including
'disableAutomation:true' in the parameter definition.
function Reset() {
SetParameter('slider', 0);}
var PluginParameters = [{name:'slider', type:'lin', defaultValue:0.5,
numberOfSteps:100, minValue:0, maxValue:1}];
MainStage Scripter MIDI plug-in ParameterChanged
function
The ParameterChanged() function lets you perform tasks triggered by changes to plug-in
parameters. ParameterChanged is called each time one of the plug-in parameters is set to
a new value. ParameterChanged is also called once for each parameter when you load a
plug-in setting.
ParameterChanged is called with two arguments, first the parameter index (an integer
number starting from 0), then the parameter value (a number).
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
MainStage Scripter MIDI plug-in Script Editor.