html5 audio fix
This commit is contained in:
parent
b95aabcc7b
commit
3110aaa39d
3 changed files with 5 additions and 6 deletions
|
@ -217,7 +217,8 @@ Event.add(window, "load", function(event) {
|
||||||
var pianoKey = data.note - MIDI.pianoKeyOffset;
|
var pianoKey = data.note - MIDI.pianoKeyOffset;
|
||||||
var d = colorElements[pianoKey];
|
var d = colorElements[pianoKey];
|
||||||
if (data.message === 144) {
|
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";
|
d.style.color = "#fff";
|
||||||
} else {
|
} else {
|
||||||
d.style.background = "";
|
d.style.background = "";
|
||||||
|
|
|
@ -100,7 +100,7 @@ connect.audiotag = function(filetype, instruments, callback) {
|
||||||
} else {
|
} else {
|
||||||
DOMLoader.script.add({
|
DOMLoader.script.add({
|
||||||
src: MIDI.soundfontUrl + instrumentId + "-" + filetype + ".js",
|
src: MIDI.soundfontUrl + instrumentId + "-" + filetype + ".js",
|
||||||
verify: instrumentId,
|
verify: "MIDI.Soundfont." + instrumentId,
|
||||||
callback: function() {
|
callback: function() {
|
||||||
if (MIDI.loader) MIDI.loader.update(null, "Downloading...", 100);
|
if (MIDI.loader) MIDI.loader.update(null, "Downloading...", 100);
|
||||||
queue.getNext();
|
queue.getNext();
|
||||||
|
|
|
@ -282,10 +282,9 @@ if (window.Audio) (function () {
|
||||||
var id = note2id[note];
|
var id = note2id[note];
|
||||||
if (!notes[id]) return;
|
if (!notes[id]) return;
|
||||||
if (delay) {
|
if (delay) {
|
||||||
var interval = window.setTimeout(function () {
|
return window.setTimeout(function () {
|
||||||
playChannel(channel, id);
|
playChannel(channel, id);
|
||||||
}, delay * 1000);
|
}, delay * 1000);
|
||||||
return interval;
|
|
||||||
} else {
|
} else {
|
||||||
playChannel(channel, id);
|
playChannel(channel, id);
|
||||||
}
|
}
|
||||||
|
@ -362,10 +361,9 @@ if (window.Audio) (function () {
|
||||||
note = id + "" + noteReverse[note];
|
note = id + "" + noteReverse[note];
|
||||||
if (!notes[note]) return;
|
if (!notes[note]) return;
|
||||||
if (delay) {
|
if (delay) {
|
||||||
var interval = window.setTimeout(function() {
|
return window.setTimeout(function() {
|
||||||
notes[note].play({ volume: velocity * 2 });
|
notes[note].play({ volume: velocity * 2 });
|
||||||
}, delay * 1000);
|
}, delay * 1000);
|
||||||
return interval;
|
|
||||||
} else {
|
} else {
|
||||||
notes[note].play({ volume: velocity * 2 });
|
notes[note].play({ volume: velocity * 2 });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue