10.6

Table Of Contents
207Logic Pro Effects
Logic Pro Scripter MIDI plug-in ProcessMIDI function
The ProcessMIDI() function lets you perform periodic (generally timing-related) tasks. The
function can be used when scripting a sequencer, an arpeggiator, or another tempo-driven
MIDI effect. ProcessMIDI is generally not required for applications that don’t make use of
musical timing information from the host. ProcessMIDI is called once per “process block,
which is determined by the host audio settings (sample rate and buffer size).
This function is often used in combination with the TimingInfo object to make use of timing
information from Logic Pro. The use of ProcessMIDI and the TimingInfo object is shown in
the example. Also see Use the JavaScript TimingInfo object.
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.
Important: To enable the GetTimingInfo feature, you need to add var NeedsTimingInfo =
true; at the global script level (outside of any functions).
Tutorial script 4: Process MIDI Callback
Text following /* shows comments that explain the JavaScript code.
/* Define NeedsTimingInfo as true at the global level to enable
GetHostInfo() */
var NeedsTimingInfo = true;
function ProcessMIDI() {
var info = GetTimingInfo(); /* get a TimingInfo object from the host
if the transport is running */
if (info.playing) {
Trace(info.tempo); /* print the tempo in the plug-in console */
}
}
Logic Pro Scripter MIDI plug-in GetParameter function
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 Logic Pro
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
Logic Pro Scripter MIDI plug-in Script Editor.