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

converters.py: Reorder the branchStart step

This commit is contained in:
Viv 2023-07-09 14:14:39 -04:00
parent 7d9ab6f7b2
commit fac814f6de

View File

@ -145,22 +145,6 @@ def convertTJAToFumen(tja):
measureFumen['gogo'] = measureTJA['gogo'] measureFumen['gogo'] = measureTJA['gogo']
measureFumen['bpm'] = measureTJA['bpm'] measureFumen['bpm'] = measureTJA['bpm']
# Check to see if the measure contains a branching condition
if measureTJA['branchStart']:
if measureTJA['branchStart'][0] == 'p':
if currentBranch == 'normal':
idx_b1, idx_b2 = 0, 1
elif currentBranch == 'advanced':
idx_b1, idx_b2 = 2, 3
elif currentBranch == 'master':
idx_b1, idx_b2 = 4, 5
measureFumen['branchInfo'][idx_b1] = int(total_notes_branch * measureTJA['branchStart'][1] * 20)
measureFumen['branchInfo'][idx_b2] = int(total_notes_branch * measureTJA['branchStart'][2] * 20)
elif measureTJA['branchStart'][0] == 'r':
measureFumen['branchInfo'] = measureTJA['branchStart'][1:] * 3
total_notes_branch = 0
total_notes_branch += note_counter_branch
# Compute the duration of the measure # Compute the duration of the measure
measureSize = measureTJA['time_sig'][0] / measureTJA['time_sig'][1] measureSize = measureTJA['time_sig'][0] / measureTJA['time_sig'][1]
measureLength = measureTJA['pos_end'] - measureTJA['pos_start'] measureLength = measureTJA['pos_end'] - measureTJA['pos_start']
@ -204,6 +188,22 @@ def convertTJAToFumen(tja):
if measureTJA['barline'] is False or (measureRatio != 1.0 and measureTJA['pos_start'] != 0): if measureTJA['barline'] is False or (measureRatio != 1.0 and measureTJA['pos_start'] != 0):
measureFumen['barline'] = False measureFumen['barline'] = False
# Check to see if the measure contains a branching condition
if measureTJA['branchStart']:
if measureTJA['branchStart'][0] == 'p':
if currentBranch == 'normal':
idx_b1, idx_b2 = 0, 1
elif currentBranch == 'advanced':
idx_b1, idx_b2 = 2, 3
elif currentBranch == 'master':
idx_b1, idx_b2 = 4, 5
measureFumen['branchInfo'][idx_b1] = int(total_notes_branch * measureTJA['branchStart'][1] * 20)
measureFumen['branchInfo'][idx_b2] = int(total_notes_branch * measureTJA['branchStart'][2] * 20)
elif measureTJA['branchStart'][0] == 'r':
measureFumen['branchInfo'] = measureTJA['branchStart'][1:] * 3
total_notes_branch = 0
total_notes_branch += note_counter_branch
# 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_branch = 0 note_counter_branch = 0
note_counter = 0 note_counter = 0