From 3110aaa39d74b62e61ba2a3202e72e194d8037fe Mon Sep 17 00:00:00 2001 From: Michael Deal Date: Fri, 25 Jan 2013 15:33:50 -0800 Subject: [PATCH] html5 audio fix --- demo-MIDIPlayer.html | 3 ++- js/MIDI/LoadPlugin.js | 2 +- js/MIDI/Plugin.js | 6 ++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/demo-MIDIPlayer.html b/demo-MIDIPlayer.html index c4027aa..62f44c6 100644 --- a/demo-MIDIPlayer.html +++ b/demo-MIDIPlayer.html @@ -217,7 +217,8 @@ Event.add(window, "load", function(event) { var pianoKey = data.note - MIDI.pianoKeyOffset; var d = colorElements[pianoKey]; if (data.message === 144) { - d.style.background = colorMap[data.note-27].hex; + var map = colorMap[data.note - 27]; + if (map) d.style.background = map.hex; d.style.color = "#fff"; } else { d.style.background = ""; diff --git a/js/MIDI/LoadPlugin.js b/js/MIDI/LoadPlugin.js index 1a8b12c..88ee7de 100644 --- a/js/MIDI/LoadPlugin.js +++ b/js/MIDI/LoadPlugin.js @@ -100,7 +100,7 @@ connect.audiotag = function(filetype, instruments, callback) { } else { DOMLoader.script.add({ src: MIDI.soundfontUrl + instrumentId + "-" + filetype + ".js", - verify: instrumentId, + verify: "MIDI.Soundfont." + instrumentId, callback: function() { if (MIDI.loader) MIDI.loader.update(null, "Downloading...", 100); queue.getNext(); diff --git a/js/MIDI/Plugin.js b/js/MIDI/Plugin.js index c1b034d..ca6acdf 100644 --- a/js/MIDI/Plugin.js +++ b/js/MIDI/Plugin.js @@ -282,10 +282,9 @@ if (window.Audio) (function () { var id = note2id[note]; if (!notes[id]) return; if (delay) { - var interval = window.setTimeout(function () { + return window.setTimeout(function () { playChannel(channel, id); }, delay * 1000); - return interval; } else { playChannel(channel, id); } @@ -362,10 +361,9 @@ if (window.Audio) (function () { note = id + "" + noteReverse[note]; if (!notes[note]) return; if (delay) { - var interval = window.setTimeout(function() { + return window.setTimeout(function() { notes[note].play({ volume: velocity * 2 }); }, delay * 1000); - return interval; } else { notes[note].play({ volume: velocity * 2 }); }