Skip to content

Commit

Permalink
Made temporary fix to play MIDI files correctly. See issue mudcube#165.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcortez committed Jul 17, 2016
1 parent a8a8425 commit f1f418a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
13 changes: 8 additions & 5 deletions build/MIDI.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,9 @@ var startAudio = function(currentTime, fromCache, onsuccess) {
///
for (var n = 0; n < length && messages < 100; n++) {
var obj = data[n];
if ((queuedTime += obj[1]) <= currentTime) {
// Temporary fix mentioned in issue #165
//if ((queuedTime += obj[1]) <= currentTime) {
if ((queuedTime += obj[1]) < currentTime || currentTime >= midi.endTime) {
offset = queuedTime;
continue;
}
Expand Down Expand Up @@ -839,6 +841,7 @@ var stopAudio = function() {
};

})();

/*
----------------------------------------------------------------------
AudioTag <audio> - OGG or MPEG Soundbank
Expand Down Expand Up @@ -1395,14 +1398,14 @@ var stopAudio = function() {
plugin = access;
var pluginOutputs = plugin.outputs;
if (typeof pluginOutputs == 'function') { // Chrome pre-43
output = pluginOutputs()[0];
output = pluginOutputs()[0];
} else { // Chrome post-43
output = pluginOutputs[0];
output = pluginOutputs[0];
}
if (output === undefined) { // nothing there...
errFunction();
errFunction();
} else {
opts.onsuccess && opts.onsuccess();
opts.onsuccess && opts.onsuccess();
}
}, errFunction);
};
Expand Down
Loading

0 comments on commit f1f418a

Please sign in to comment.