2 changed files with 0 additions and 17 deletions
Binary file not shown.
@ -1,17 +0,0 @@ |
|||||||
(function(){function v(){j=k.getMIDIAccess();e=k.getSequencer();var b=function(a){return a.replace(/data:audio\/mid[i]?;base64,/,"")};p={addEventListener:function(a,b,c){c?(e.addEventListener(a),"midimessage"===a?q=b:"metamessage"===a&&(r=b)):e.addEventListener(a,{listener:b})},stop:function(){e.stop()},play:function(){e.play()},pause:function(){e.pause()},isPlaying:function(){return e.isRunning()},loadBase64String:function(a){return e.loadBase64String(b(a))},playBase64String:function(a){return e.playBase64String(b(a))}, |
|
||||||
getMicrosecondPosition:function(){return e.getMicrosecondPosition()},setMicrosecondPosition:function(a){e.setMicrosecondPosition(a)},setTempoInBPM:function(a){e.setTempoInBPM(a)},getTempoFactor:function(){return e.getTempoFactor()},setTempoFactor:function(a){e.setTempoFactor(a)},getTempoInBPM:function(){return e.getTempoInBPM()},getTracks:function(){return e.getTracks()},muteTrack:function(a){return e.muteTrack(a)},unmuteTrack:function(a){return e.unmuteTrack(a)},getSequence:function(){return e.getSequence()}, |
|
||||||
setDirectOutput:function(a){return e.setDirectOutput(a.getDevice())},removeDirectOutput:function(){e.removeDirectOutput()},hasDirectOutput:function(){return e.hasDirectOutput()}};var c=function(a){if(!a)return i&&console.log("device does not exist"),null;try{if("input"==a.deviceType)a=j.getInput(a);else if("output"==a.deviceType)a=j.getOutput(a);else return i&&console.log("error while getting device",a.deviceName),null}catch(b){return i&&console.log("error while getting device",a.deviceName),null}return{close:function(){a.close()}, |
|
||||||
open:function(){if(a.open())return!0;i&&console.log("could not open device",a.deviceName);return!1},addEventListener:function(b,c,d){d?(a.addEventListener(b),t[a.id]=function(a){console.log("applet context");l&&l[a.command]?i&&console.log("MIDI message intercepted",a.command,a.channel,a.data1,a.data2):c(a)}):a.addEventListener(b,{listener:function(a){l&&l[a.command]?i&&console.log("MIDI message intercepted",a.command,a.channel,a.data1,a.data2):c(a)}})},sendMIDIMessage:function(b){a.getDevice().isOpen()&& |
|
||||||
a.sendMIDIMessage(b)},toString:function(){return a.toString()},getDevice:function(){return a},setDirectOutput:function(b){return a.setDirectOutput(b.getDevice())},removeDirectOutput:function(){a.removeDirectOutput()},hasDirectOutput:function(){return a.hasDirectOutput()},deviceType:a.deviceType,deviceName:a.deviceName,deviceManufacturer:a.deviceManufacturer,deviceDescription:a.deviceDescription}};s({enumerateInputs:function(){return j.enumerateInputs()},enumerateOutputs:function(){return j.enumerateOutputs()}, |
|
||||||
getInput:function(a){return c(a)},getOutput:function(a){return c(a)},closeInputs:function(){j.closeInputs()},closeOutputs:function(){j.closeOutputs()},createMIDIMessage:function(a,b,c,d,f){return j.createMIDIMessage(a,b,c,d,f||-1)}})}function w(){var b=document.createElement("div"),c="";"safari/osx"!==f&&-1===f.indexOf("chrome")?(c=c+'<object tabindex="0" id="midibridge-applet" type="application/x-java-applet" height="1" width="1">'+('<param name="codebase" value="'+n+'/" />'),c+='<param name="archive" value="'+ |
|
||||||
u+'" />',c+='<param name="code" value="net.abumarkub.midi.MIDIApplet" /><param name="scriptable" value="true" /><param name="minJavaVersion" value="1.6" />Your browser needs the Java plugin to use the midibridge. You can download it <a href="http://www.java.com/en/" target="blank" title="abumarkub midibridge download java" rel="abumarkub midibridge download java">here</a></object>'):(c+='<applet id="midibridge-applet" code="net.abumarkub.midi.MIDIApplet.class" archive="'+u+'" codebase="'+n+'" width="1" height="1" mayscript>', |
|
||||||
c+='<param name="minJavaVersion" value="1.6"></applet>');b.setAttribute("id","midibridge-java");b.innerHTML=c;document.body.appendChild(b)}try{console.log("")}catch(x){console={log:function(){}}}var g={NOTE_OFF:128,NOTE_ON:144,POLY_PRESSURE:160,CONTROL_CHANGE:176,PROGRAM_CHANGE:192,CHANNEL_PRESSURE:208,PITCH_BEND:224,SYSTEM_EXCLUSIVE:240,MIDI_TIMECODE:241,SONG_POSITION:242,SONG_SELECT:243,TUNE_REQUEST:246,EOX:247,TIMING_CLOCK:248,START:250,CONTINUE:251,STOP:252,ACTIVE_SENSING:254,SYSTEM_RESET:255, |
|
||||||
NOTE_NAMES_SHARP:"sharp",NOTE_NAMES_FLAT:"flat",NOTE_NAMES_SOUNDFONT:"soundfont",NOTE_NAMES_ENHARMONIC_SHARP:"enh-sharp",NOTE_NAMES_ENHARMONIC_FLAT:"enh-flat",version:"0.6.3",noteNameModus:"sharp",userAgent:""},l=null,d=[],o={},n="lib",i=!1,s=null,m=null,q=null,r=null,t={},u="midiapplet-"+g.version+".jar",k=null,j=null,e=null,p=null,h=navigator.userAgent.toLowerCase(),f;-1!==h.indexOf("firefox")?f="firefox":-1!==h.indexOf("chrome")?f="chrome":-1!==h.indexOf("safari")?f="safari":-1!==h.indexOf("opera")? |
|
||||||
f="opera":-1!==h.indexOf("msie 7")?f="msie7":-1!==h.indexOf("msie 8")?f="msie8":-1!==h.indexOf("msie 9")&&(f="msie9");-1!==h.indexOf("linux")?f+="/linux":-1!==h.indexOf("macintosh")?f+="/osx":-1!==h.indexOf("windows")&&(f+="/win");g.userAgent=f;d[128]="NOTE OFF";d[144]="NOTE ON";d[160]="POLY PRESSURE";d[176]="CONTROL CHANGE";d[192]="PROGRAM CHANGE";d[208]="CHANNEL PRESSURE";d[224]="PITCH BEND";d[240]="SYSTEM EXCLUSIVE";d[241]="MIDI TIMECODE";d[242]="SONG POSITION";d[243]="SONG SELECT";d[244]="RESERVED 1"; |
|
||||||
d[245]="RESERVED 2";d[246]="TUNE REQUEST";d[247]="EOX";d[248]="TIMING CLOCK";d[249]="RESERVED 3";d[250]="START";d[251]="CONTINUE";d[252]="STOP";d[254]="ACTIVE SENSING";d[255]="SYSTEM RESET";o={sharp:"C C# D D# E F F# G G# A A# B".split(" "),flat:"C D♭ D E♭ E F G♭ G A♭ A B♭ B".split(" "),soundfont:"C Db D Eb E F Gb G Ab A Bb B".split(" "),"enh-sharp":"B# C# C## D# D## E# F# F## G# G## A# A##".split(" "),"enh-flat":"D♭♭ D♭ E♭♭ E♭ F♭ G♭♭ G♭ A♭♭ A♭ B♭♭ B♭ C♭".split(" ")}; |
|
||||||
g.init=function(){function b(a,b){document.body.style.color="#f00";document.body.style.fontSize="20px";document.body.style.padding="50px";document.body.style.lineHeight="1.4em";document.body.innerHTML=a+" is not supported.<br/>please use "+b}if("safari/win"===f)b("Safari for Windows","Internet Explorer 8+, Chrome, Firefox or Opera");else if("msie7/win"===f)b("Internet Explorer 7","Internet Explorer 8+, Chrome, Firefox or Opera");else{var c=Array.prototype.slice.call(arguments);if(1===c.length&&"function"=== |
|
||||||
typeof c[0])s=c[0];else if(2===c.length&&"object"===typeof c[0]&&"function"===typeof c[1]){var a=c[0],e,g,h,j;s=c[1];m=a.onError;i=a.debug;n=a.javaDir||n;c=function(a,b){l={};for(h in d){var c=!b;e=0;for(g=a.length;e<g;e++)if(j=a[e],j==h){c=b;break}l[h]=c}};a.filterCommands?c(a.filterCommands,!0):a.passCommands&&c(a.passCommands,!1);i&&console.log(l,f)}navigator.javaEnabled()?w():m?m("No java plugin found; install or enable the java plugin"):(document.body.style.color="#f00",document.body.style.fontSize= |
|
||||||
"20px",document.body.style.padding="50px",document.body.innerHTML="No java plugin found; install or enable the java plugin")}};g.error=function(b){m?m(b):i&&console.log(b)};g.ready=function(){(function c(a){i&&console.log("applet:",null===k);try{k=-1!==f.indexOf("msie")||-1!==f.indexOf("chrome")||-1!==f.indexOf("safari")?window["midibridge-applet"]:document["midibridge-applet"],k.ready()}catch(d){i&&console.log(d);setTimeout(function(){c(a)},25);return}k?a():(i&&console.log(k),setTimeout(function(){c(a)}, |
|
||||||
25))})(v)};g.getSequencer=function(){return!p?(i&&console.log("Sequencer not (yet) available"),null):p};g.onMIDIData=function(){var b=Array.prototype.slice.call(arguments);t[b[0]]({command:b[1],channel:b[2],data1:b[3],data2:b[4],timeStamp:b[5],toString:function(){return b[6]}})};g.onSequencerMetaData=function(){var b=Array.prototype.slice.call(arguments);if(r){for(var c={type:b[0],status:b[1],data:[]},a=2,d=b.length;a<d;a++)c.data.push(b[a]);r(c)}};g.onSequencerMIDIData=function(){var b=Array.prototype.slice.call(arguments); |
|
||||||
q&&q({command:b[0],channel:b[1],data1:b[2],data2:b[3],timeStamp:b[4],toString:function(){return b[5]}})};g.getNoteName=function(b,c){c||(c=g.NOTE_NAMES_SHARP);return o[c][b%12]+""+Math.floor(b/12-1)};g.getNoteNumber=function(b,c){var a=-1,b=b.toUpperCase(),d;for(d in o)for(var e=o[d],f=0,g=e.length;f<g;f++)if(e[f]===b){a=f;break}return-1===a?"invalid note name":12+a+12*c};g.getCommandVerbose=function(b){return d[b]};g.formatMicroseconds=function(b){var c=b/1E3/1E3>>0,a=c/3600>>0,d=c%3600/60>>0,c= |
|
||||||
c%60,b=b/1E3-36E5*a-6E4*d-1E3*c+0.5>>0;return""+(0<a?a+":":"")+(0<a?10>d?"0"+d:d:d)+":"+(10>c?"0"+c:c)+":"+(0===b?"000":10>b?"00"+b:100>b?"0"+b:b)};g.wrapElement=function(b){"msie8/win"===f&&(b.addEventListener=function(c,a){b.attachEvent(c,a)})};window.addEventListener||(window.addEventListener=function(b,c){window.attachEvent("onload",c)});window.midiBridge=g})(window); |
|
||||||
Loading…
Reference in new issue