Jazz-Soft.net

We make it sound!

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

MidiInOpen()

Function

MidiInOpen ( name ) or

MidiInOpen ( index ) or

MidiInOpen ( name, callback ) or

MidiInOpen ( index, callback ) - open specified MIDI In connection.

name is the device name string as returned from MidiInList().

index is an integer (zero-based) index of the device in the array output by MidiInList().

callback is the callback function in either of the following forms:

- function callback(timestamp, array){ ... } or

- function callback(timestamp, byte1, byte2, byte3){ ... },

where timestamp is the time since the plugin initialization in milliseconds,

array contains the bytes of incoming MIDI message of arbitrary length,

and byte1, byte2, byte3 represent short MIDI message (1 to 3 bytes long).

Later syntax is deprecated and left mainly for backward compatibility, however, it may be useful if your application wants to ignore long messages.

Timestamp may be useful to deal with JavaScript latency effects, but in most cases it can be safely ignored.

If the callback functuon is not specified, MIDI input can be polled in sequential manner with QueryMidiIn(). (v.1.3 or later)

Returns the name of the opened device. If failed, returns the name of previously opened device, that remains open.

Example

Jazz.MidiInOpen(0,function(t,a){ Jazz.MidiOutLong(a);});      // recommended
Jazz.MidiInOpen(0,function(t,a,b,c){ Jazz.MidiOut(a,b,c);});  // deprecated

See also