The ProcessMIDI() function lets you perform periodic (generally timing-related) tasks. This can be used when scripting a sequencer, an arpeggiator, or another tempo-driven MIDI effect. ProcessMIDI is generally not required for applications that do not make use of musical timing information from the host. ProcessMIDI is called once per “process block,” which is determined by the host’s audio settings (sample rate and buffer size).
This function is often used in combination with the “JavaScript TimingInfo object” to make use of timing information from Logic Pro X. The use of ProcessMIDI and the TimingInfo object is shown in the example. Also see Use the JavaScript TimingInfo object.
Note: To enable the GetTimingInfo feature, you need to add NeedsTimingInfo = true; at the global script level (outside of any functions).
Code example
// Define NeedsTimingInfo as true at the global scope to enable GetHostInfo()NeedsTimingInfo = true;function ProcessMIDI() {var info = GetTimingInfo(); // get a TimingInfo object from the hostif (info.playing) { // if the transport is runningTrace(info.tempo); // print the tempo in the plugin console}}