Jazz-Soft.net

We make it sound!

Home » Documentation » Jazz-Plugin » Reference » QueryMidiIn()

QueryMidiIn()

Function

QueryMidiIn () - check for available MIDI input.

Returns an array containing the timestamp followed by the MIDI message (or nothing if the input queue is empty).

MIDI In connection must be opened with MidiInOpen() with no callback specified.

Input queue remains available after the connection is closed, but opening another (or the same) connection will clear the queue.

Example

Jazz.MidiOutOpen(0);               // default MIDI Out
Jazz.MidiInOpen(0);                // default MIDI In, no callback
window.setInterval(function(){     // start the polling cycle
 var arr;
 while(arr=Jazz.QueryMidiIn()){    // while the queue is not empty
  var timestamp=arr[0];            // the first element is the time stamp
  var msg=arr.slice(1,arr.length); // the rest is the message
  Jazz.MidiOutLong(msg);           // play it!
 }
},0);

See also