Update inc/jasmid/replayer.js

master
ragamroll 2013-02-19 12:01:39 -08:00
parent 072eadb4af
commit a5160b624f
1 changed files with 5 additions and 1 deletions

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