Fix empty measures being ignored

This commit is contained in:
LoveEevee 2018-10-11 02:41:02 +03:00
parent 39655fc534
commit 4b986c62ec

View File

@ -123,6 +123,29 @@
var circleID = 0 var circleID = 0
var pushMeasure = () => { var pushMeasure = () => {
if(barLine){
var note = currentMeasure[0]
if(note){
var speed = note.bpm * note.scroll / 60
}else{
var speed = bpm * scroll / 60
}
this.measures.push({
ms: ms,
speed: speed
})
if(firstMeasure){
firstMeasure = false
var msPerMeasure = 60000 * measure / bpm
for(var measureMs = ms - msPerMeasure; measureMs > 0; measureMs -= msPerMeasure){
this.measures.push({
ms: measureMs,
speed: speed
})
}
}
}
if(currentMeasure.length){
for(var i = 0; i < currentMeasure.length; i++){ for(var i = 0; i < currentMeasure.length; i++){
var note = currentMeasure[i] var note = currentMeasure[i]
if(firstNote && note.type){ if(firstNote && note.type){
@ -160,27 +183,9 @@
circles.push(circleObj) circles.push(circleObj)
} }
} }
if(barLine){
var note = currentMeasure[0]
if(note){
var speed = note.bpm * note.scroll / 60
}else{ }else{
var speed = bpm * scroll / 60
}
this.measures.push({
ms: ms,
speed: speed
})
if(firstMeasure){
firstMeasure = false
var msPerMeasure = 60000 * measure / bpm var msPerMeasure = 60000 * measure / bpm
for(var measureMs = ms - msPerMeasure; measureMs > 0; measureMs -= msPerMeasure){ ms += msPerMeasure
this.measures.push({
ms: measureMs,
speed: speed
})
}
}
} }
} }
@ -231,6 +236,9 @@
case "delay": case "delay":
ms += (parseFloat(value) || 0) * 1000 ms += (parseFloat(value) || 0) * 1000
break break
case "barlineon":
barLine = true
break
case "barlineoff": case "barlineoff":
barLine = false barLine = false
break break