3.5

Table Of Contents
208MainStage Effects
The code shown below controls any plug-in parameter with the modwheel. To test the
function in Tutorial script 15, insert any plug-in or software instrument on the same
channel and run the script. Choose Learn plug-in parameter in the menu, then click any
plug-in parameter to control it with the modwheel.
To create a menu for the modwheel target, name the menu entry and set it to a “target”
type.
var PluginParameters = [
/* parameter 0 */
{
name:"Modwheel Target",
type:"target"
}];
HandleMIDI is called every time Scripter receives a MIDI event in Tutorial script 15. The
code shown below remaps the modulation wheel to the target chosen in the menu.
function HandleMIDI(incomingEvent)
{
/* remap modulation to target selected in menu and
check for incoming CC event with number 1 (Modwheel) */
if ((incomingEvent instanceof ControlChange) && (incomingEvent.number == 1))
{
var newEvent = new TargetEvent(); /* create new Target event */
newEvent.target = "Modwheel Target"; /* name the menu entry to be used by
this event */
newEvent.value = incomingEvent.value / 127; /* rescale from 0..127 to
0.0...1.0 */
newEvent.send(); /* send the event */
} else
{
/* send all other events */
incomingEvent.send();
};
};
Use the JavaScript TimingInfo object
The TimingInfo object contains timing information that describes the state of the host
transport and the current musical tempo and meter. A TimingInfo object can be retrieved
by calling GetTimingInfo().
TimingInfo properties
TimingInfo.playing: Uses Boolean logic where “true” means the host transport is
running.