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,43 +123,6 @@
var circleID = 0
var pushMeasure = () => {
for(var i = 0; i < currentMeasure.length; i++){
var note = currentMeasure[i]
if(firstNote && note.type){
firstNote = false
if(ms < 0){
this.soundOffset = ms
ms = 0
}
}
note.start = ms
if(note.endDrumroll){
note.endDrumroll.endTime = ms
}
var msPerMeasure = 60000 * measure / bpm
ms += msPerMeasure / currentMeasure.length
}
for(var i = 0; i < currentMeasure.length; i++){
var note = currentMeasure[i]
if(note.type){
circleID++
var circleObj = new Circle({
id: circleID,
start: note.start,
type: note.type,
txt: note.txt,
speed: note.bpm * note.scroll / 60,
gogoTime: note.gogo,
endTime: note.endTime,
requiredHits: note.requiredHits
})
if(lastDrumroll === note){
lastDrumroll = circleObj
}
circles.push(circleObj)
}
}
if(barLine){
var note = currentMeasure[0]
if(note){
@ -182,6 +145,48 @@
}
}
}
if(currentMeasure.length){
for(var i = 0; i < currentMeasure.length; i++){
var note = currentMeasure[i]
if(firstNote && note.type){
firstNote = false
if(ms < 0){
this.soundOffset = ms
ms = 0
}
}
note.start = ms
if(note.endDrumroll){
note.endDrumroll.endTime = ms
}
var msPerMeasure = 60000 * measure / bpm
ms += msPerMeasure / currentMeasure.length
}
for(var i = 0; i < currentMeasure.length; i++){
var note = currentMeasure[i]
if(note.type){
circleID++
var circleObj = new Circle({
id: circleID,
start: note.start,
type: note.type,
txt: note.txt,
speed: note.bpm * note.scroll / 60,
gogoTime: note.gogo,
endTime: note.endTime,
requiredHits: note.requiredHits
})
if(lastDrumroll === note){
lastDrumroll = circleObj
}
circles.push(circleObj)
}
}
}else{
var msPerMeasure = 60000 * measure / bpm
ms += msPerMeasure
}
}
for(var lineNum = meta.start; lineNum < meta.end; lineNum++){
@ -231,6 +236,9 @@
case "delay":
ms += (parseFloat(value) || 0) * 1000
break
case "barlineon":
barLine = true
break
case "barlineoff":
barLine = false
break