html5 audio fix

master
Michael Deal 2013-01-25 15:33:50 -08:00
parent b95aabcc7b
commit 3110aaa39d
3 changed files with 5 additions and 6 deletions

View File

@ -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 = "";

View File

@ -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();

View File

@ -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 });
}