10.6

Table Of Contents
209Logic Pro Effects
Logic Pro 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
Logic Pro Scripter MIDI plug-in Script Editor.
Tutorial script 6: Parameter Changed Callback
Print parameter changes to the plug-in console. This example also creates a slider in the
plug-in window and assigns the ParameterChanged function to it.
Text following /* shows comments that explain the JavaScript code.
var PluginParameters = [{name:"Slider", type:"lin", minValue:0, maxValue:1,
numberOfSteps:100, defaultValue:0}];
/* create a slider with a value range of 0.0 to 1.0 and a default value of
0 */
function ParameterChanged(param, value) {
/* if it is the slider you just created */
if (param == 0) {
Trace(value); /* print the value to the console */
}
}
Logic Pro Scripter MIDI plug-in Reset function
Reset() is called when you bypass the Scripter plug-in and when the transport is started.
You can implement this function to clear the plug-in history and set Scripter to its
default state.
JavaScript objects overview
The Scripter plug-in provides JavaScript objects that describe or represent MIDI
information and information about Logic Pro, in addition to performing MIDI
processing-related functions. See these sections for details about different object types.
Use the JavaScript Event object
Use the JavaScript TimingInfo object
Use the Trace object
Use the MIDI event beatPos property
Use the JavaScript MIDI object