1
0
mirror of synced 2024-11-28 06:50:49 +01:00

converters.py: Sort notes by absolute position

This commit is contained in:
Viv 2024-01-30 20:15:41 -05:00
parent 42ae83ff3e
commit 8e691a0176

View File

@ -430,6 +430,9 @@ def fix_dk_note_types(dk_notes: List[FumenNote]) -> None:
NB: Modifies FumenNote objects in-place
"""
# Sort the notes by their absolute positions to account for BPMCHANGE
dk_notes = sorted(dk_notes, key=lambda note: note.pos_abs)
# Get the differences between each note and the previous one
for (note_1, note_2) in zip(dk_notes, dk_notes[1:]):
note_1.diff = round(note_2.pos_abs - note_1.pos_abs, 9)