X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=python%2Fmusicxml.py;h=3466473c4352a879c2d1259e46f4f3b6d90f6f4a;hb=9fbb1bd9e09a90087f18d11205921d80821c79b2;hp=b390485c5b9c708f91535ab023d9827ed789593e;hpb=baf8c957f8021e07d5ad4503f0eb45309e77ef55;p=lilypond.git diff --git a/python/musicxml.py b/python/musicxml.py index b390485c5b..3466473c43 100644 --- a/python/musicxml.py +++ b/python/musicxml.py @@ -165,7 +165,7 @@ class Attributes (Measure_element): "return (fifths, mode) tuple" key = self.get_named_attribute ('key') - mode_node = self.get_maybe_exist_named_child ('mode') + mode_node = key.get_maybe_exist_named_child ('mode') mode = 'major' if mode_node: mode = mode_node.get_text () @@ -276,7 +276,8 @@ class Part (Music_xml_node): attributes_dict = {} attributes_object = None measures = self.get_typed_children (Measure) - + last_moment = Rational (-1) + last_measure_position = Rational (-1) for m in measures: measure_start_moment = now measure_position = Rational (0) @@ -291,9 +292,9 @@ class Part (Music_xml_node): factor = Rational (1, int (attributes_dict['divisions'].get_text ())) - elif (n.get_maybe_exist_typed_child (Duration) - and not n.get_maybe_exist_typed_child (Chord)): - + + + if (n.get_maybe_exist_typed_child (Duration)): mxl_dur = n.get_maybe_exist_typed_child (Duration) dur = mxl_dur.get_length () * factor @@ -308,7 +309,14 @@ class Part (Music_xml_node): and attributes_object.get_measure_length () == dur): rest._is_whole_measure = True - + + if (dur > Rational (0) + and n.get_maybe_exist_typed_child (Chord)): + now = last_moment + measure_position = last_measure_position + + last_moment = now + last_measure_position = measure_position n._when = now n._measure_position = measure_position @@ -328,8 +336,10 @@ class Part (Music_xml_node): problem = 'incomplete' if now > new_now: problem = 'overfull' - - m.message ('%s measure? Expected: %s, Difference: %s' % (problem, now, new_now - now)) + + ## only for verbose operation. + if problem <> 'incomplete': + m.message ('%s measure? Expected: %s, Difference: %s' % (problem, now, new_now - now)) now = new_now