Update inc/jasmid/replayer.js

This commit is contained in:
ragamroll 2013-02-19 12:01:39 -08:00
parent 072eadb4af
commit a5160b624f

View file

@ -59,6 +59,10 @@ function Replayer(midiFile, timeWarp, eventProcessor) {
//
function processEvents() {
function processNext() {
if ( midiEvent.event.type == "meta" && midiEvent.event.subtype == "setTempo" ) {
// tempo change events can occur anywhere in the middle and affect events that follow
beatsPerMinute = 60000000 / midiEvent.event.microsecondsPerBeat;
}
if (midiEvent.ticksToEvent > 0) {
var beatsToGenerate = midiEvent.ticksToEvent / ticksPerBeat;
var secondsToGenerate = beatsToGenerate / (beatsPerMinute / 60);
@ -78,4 +82,4 @@ function Replayer(midiFile, timeWarp, eventProcessor) {
return clone(temporal);
}
};
};
};