Merge pull request #53 from LoveEevee/add-tja-support

ParseTja: Fix sub-measure bpm changes
This commit is contained in:
Bui 2018-10-11 19:18:07 +01:00 committed by GitHub
commit 4ff567d5d7

View File

@ -159,7 +159,7 @@
if(note.endDrumroll){ if(note.endDrumroll){
note.endDrumroll.endTime = ms note.endDrumroll.endTime = ms
} }
var msPerMeasure = 60000 * measure / bpm var msPerMeasure = 60000 * measure / note.bpm
ms += msPerMeasure / currentMeasure.length ms += msPerMeasure / currentMeasure.length
} }
for(var i = 0; i < currentMeasure.length; i++){ for(var i = 0; i < currentMeasure.length; i++){
@ -196,6 +196,7 @@
var line = line.slice(1).toLowerCase() var line = line.slice(1).toLowerCase()
var [name, value] = this.split(line, " ") var [name, value] = this.split(line, " ")
if(!branch || branch && branchType === branchPreference){
switch(name){ switch(name){
case "gogostart": case "gogostart":
gogo = true gogo = true
@ -209,6 +210,22 @@
case "scroll": case "scroll":
scroll = parseFloat(value) scroll = parseFloat(value)
break break
case "measure":
var [numerator, denominator] = value.split("/")
measure = numerator / denominator * 4
break
case "delay":
ms += (parseFloat(value) || 0) * 1000
break
case "barlineon":
barLine = true
break
case "barlineoff":
barLine = false
break
}
}
switch(name){
case "branchstart": case "branchstart":
branch = true branch = true
branchType = "" branchType = ""
@ -229,19 +246,6 @@
case "n": case "e": case "m": case "n": case "e": case "m":
branchType = name branchType = name
break break
case "measure":
var [numerator, denominator] = value.split("/")
measure = numerator / denominator * 4
break
case "delay":
ms += (parseFloat(value) || 0) * 1000
break
case "barlineon":
barLine = true
break
case "barlineoff":
barLine = false
break
} }
}else if(!branch || branch && branchType === branchPreference){ }else if(!branch || branch && branchType === branchPreference){