converters.py
: Explicitly specify idx_m-1
For non-branching songs, `-1` == `idx_m-1`. But, for branching songs, we will repeatedly visit the same measures to populate the different branches. This means that the relative index `-1` is no longer valid.
This commit is contained in:
parent
e1b089a595
commit
f0ff74c190
@ -138,9 +138,9 @@ def convertTJAToFumen(tja):
|
|||||||
# Compute the 1st measure's offset by subtracting the 2nd measure's duration from the tjaOffset
|
# Compute the 1st measure's offset by subtracting the 2nd measure's duration from the tjaOffset
|
||||||
if idx_m == 1:
|
if idx_m == 1:
|
||||||
tjaOffset = float(tja['metadata']['offset']) * 1000 * -1
|
tjaOffset = float(tja['metadata']['offset']) * 1000 * -1
|
||||||
tjaConverted['measures'][-1]['fumenOffset'] = tjaOffset - measureDurationPrev
|
tjaConverted['measures'][idx_m-1]['fumenOffset'] = tjaOffset - measureDurationPrev
|
||||||
# Use the previous measure's offset plus the previous duration to compute the current measure's offset
|
# Use the previous measure's offset plus the previous duration to compute the current measure's offset
|
||||||
measureOffsetPrev = tjaConverted['measures'][-1]['fumenOffset']
|
measureOffsetPrev = tjaConverted['measures'][idx_m-1]['fumenOffset']
|
||||||
measureFumen['fumenOffset'] = measureOffsetPrev + measureDurationPrev
|
measureFumen['fumenOffset'] = measureOffsetPrev + measureDurationPrev
|
||||||
measureDurationPrev = measureDuration
|
measureDurationPrev = measureDuration
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user