1
0
mirror of synced 2025-01-24 15:12:19 +01:00

converters.py: Migrate event code to other function

This commit is contained in:
Viv 2023-06-02 16:33:45 -04:00
parent 96ca4ab2c0
commit abd0af5f57

View File

@ -41,6 +41,9 @@ def preprocessTJAMeasures(tja):
measuresCorrected = [] measuresCorrected = []
currentBPM = 0 currentBPM = 0
currentGogo = False
currentHidden = False
for measure in tja['measures']: for measure in tja['measures']:
# Step 1: Combine notes and events # Step 1: Combine notes and events
notes = [{'pos': i, 'type': 'note', 'value': TJA_NOTE_TYPES[note]} notes = [{'pos': i, 'type': 'note', 'value': TJA_NOTE_TYPES[note]}
@ -99,10 +102,6 @@ def convertTJAToFumen(fumen, tja):
fumen['measures'] = fumen['measures'][9:] fumen['measures'] = fumen['measures'][9:]
tja['measures'] = preprocessTJAMeasures(tja) tja['measures'] = preprocessTJAMeasures(tja)
# Variables that will change over time due to events
currentGogo = False
currentHidden = False
# Parse TJA measures to create converted TJA -> Fumen file # Parse TJA measures to create converted TJA -> Fumen file
tjaConverted = {'measures': []} tjaConverted = {'measures': []}
for idx_m, measureTJA in enumerate(tja['measures']): for idx_m, measureTJA in enumerate(tja['measures']):
@ -137,11 +136,7 @@ def convertTJAToFumen(fumen, tja):
# Create note dictionaries based on TJA measure data (containing 0's plus 1/2/3/4/etc. for notes) # Create note dictionaries based on TJA measure data (containing 0's plus 1/2/3/4/etc. for notes)
note_counter = 0 note_counter = 0
for idx_d, data in enumerate(measureTJA['data']): for idx_d, data in enumerate(measureTJA['data']):
if data['type'] == 'gogo': if data['type'] == 'note':
pass
elif data['type'] == 'hidden':
pass
elif data['type'] == 'note':
note = deepcopy(default_note) note = deepcopy(default_note)
# Note positions must be calculated using the base measure duration (that uses a single BPM value) # Note positions must be calculated using the base measure duration (that uses a single BPM value)
# (In other words, note positions do not take into account any mid-measure BPM change adjustments.) # (In other words, note positions do not take into account any mid-measure BPM change adjustments.)