Jazz-Soft.net

We make it sound!

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

MidiInClose()

Function

MidiInClose () - close the active MIDI In connection.

Returns nothing.

Unlike the default (software) MIDI Out connection that one can open multiple times on different pages, you will have to share a single MIDI In device between all your pages.

A possible solution is to close MIDI In connection when the page loses focus, and reopen it when the page becomes active.

Example

// NOTE: This code may work incorrectly in some ancient browsers.
if(navigator.appName=='Microsoft Internet Explorer'){
 document.onfocusin=function(){ Jazz.MidiInOpen(0,function(t,a,b,c){ Jazz.MidiOut(a,b,c);});};
 document.onfocusout=function(){ Jazz.MidiInClose();};
} else {
 window.onfocus=function(){ Jazz.MidiInOpen(0,function(t,a,b,c){ Jazz.MidiOut(a,b,c);});};
 window.onblur=function(){ Jazz.MidiInClose();};
}

See also