1
0
mirror of synced 2024-11-24 13:40:10 +01:00

converters.py: Fix bug with measure BPM adjustment

The adjustment occurs between ANY BPM shifts, and not just mid-measure BPM shifts.

The reason I missed this is because my test song, Rokuchounen, ONLY contains mid-measure BPM shifts, and no BPM shifts that start exactly on the measure.
This commit is contained in:
Viv 2023-06-02 16:33:48 -04:00
parent f336c37b8b
commit 0a3a4ae4e6

View File

@ -113,9 +113,10 @@ def convertTJAToFumen(fumen, tja):
# - measureDurationBase: The "base" measure duration, computed using a single BPM value.
# - measureDuration: The actual measure duration, which may be adjusted if there is a mid-measure BPM change.
measureDurationBase = measureDuration = (4 * 60_000 * measureSize * measureRatio / measureTJA['bpm'])
# The following adjustment accounts for mid-measure BPM changes. (!!! Discovered by tana :3 !!!)
if measureRatio != 1.0:
measureTJANext = tja['measures'][idx_m+1]
# The following adjustment accounts for BPM changes. (!!! Discovered by tana :3 !!!)
if idx_m != len(tja['measures'])-1:
measureTJANext = tja['measures'][idx_m + 1]
if measureTJA['bpm'] != measureTJANext['bpm']:
measureDuration -= (4 * 60_000 * ((1 / measureTJANext['bpm']) - (1 / measureTJA['bpm'])))
# Apply the change in offset to the overall offset to get the measure offset