Merge pull request #13 from ragamroll/patch-1

Update inc/jasmid/replayer.js
This commit is contained in:
Michael Deal 2013-02-19 12:11:56 -08:00
commit dac4757e1e

View file

@ -59,6 +59,10 @@ function Replayer(midiFile, timeWarp, eventProcessor) {
// //
function processEvents() { function processEvents() {
function processNext() { 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) { if (midiEvent.ticksToEvent > 0) {
var beatsToGenerate = midiEvent.ticksToEvent / ticksPerBeat; var beatsToGenerate = midiEvent.ticksToEvent / ticksPerBeat;
var secondsToGenerate = beatsToGenerate / (beatsPerMinute / 60); var secondsToGenerate = beatsToGenerate / (beatsPerMinute / 60);