From: Reinhold Kainhofer Date: Fri, 26 Oct 2007 22:18:54 +0000 (+0200) Subject: MusicXML: Fix bugs with repeat detection X-Git-Tag: release/2.11.35-1~67 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=887ca6e7fd8cdc776a50d7f69e5f71fa9aced478;p=lilypond.git MusicXML: Fix bugs with repeat detection -) Sometimes the contents of the first volta was duplicated (once before and the second time inside the first volta). The cause was theat I forgot an if clause to mark the repeat's body finished when the first volta ending is encountered -) I messed up the order of the repeat/ending markers in the output. --- diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index 7238230cb7..53d5f419c1 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -179,13 +179,13 @@ def musicxml_partial_to_lily (partial_len): def group_repeats (music_list): repeat_replaced = True music_start = 0 - i=0 + i = 0 # Walk through the list of expressions, looking for repeat structure # (repeat start/end, corresponding endings). If we find one, try to find the # last event of the repeat, replace the whole structure and start over again. # For nested repeats, as soon as we encounter another starting repeat bar, # treat that one first, and start over for the outer repeat. - while repeat_replaced and i<10: + while repeat_replaced and i < 100: i += 1 repeat_start = -1 # position of repeat start / end repeat_end = -1 # position of repeat start / end @@ -220,6 +220,7 @@ def group_repeats (music_list): if e.direction == -1: if repeat_start < 0: repeat_start = 0 + if repeat_end < 0: repeat_end = pos ending_start = pos elif e.direction == 1: @@ -417,18 +418,18 @@ def musicxml_barline_to_lily (barline): repeat.times = 2 repeat.event = barline if repeat.direction == -1: - retval[1] = repeat - else: retval[3] = repeat + else: + retval[1] = repeat if ending_element and hasattr (ending_element, 'type'): ending = EndingMarker () ending.direction = {"start": -1, "stop": 1, "discontinue": 1}.get (ending_element.type, 0) ending.event = barline if ending.direction == -1: - retval[0] = ending - else: retval[4] = ending + else: + retval[0] = ending if bartype: b = musicexp.BarLine ()