]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Don't crash when a note has multiple <notations> children
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 30 Oct 2007 16:58:16 +0000 (17:58 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 30 Oct 2007 16:58:16 +0000 (17:58 +0100)
input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml [new file with mode: 0644]
scripts/musicxml2ly.py

diff --git a/input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml b/input/regression/musicxml/02h-MultipleNotationChildren-RFK.xml
new file mode 100644 (file)
index 0000000..ae2a60c
--- /dev/null
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 1.0 Partwise//EN"
+                                "http://www.musicxml.org/dtds/partwise.dtd">
+<score-partwise>
+  <movement-title>Multiple notation and articulation children</movement-title>
+  <identification>
+    <rights>Public Domain</rights>
+    <encoding>
+      <software>Hand-crafted MusicXML</software>
+    </encoding>
+    <miscellaneous>
+      <miscellaneous-field name="comment">
+          It should not make any difference whether two articulations are given
+          inside to different notation elements, inside two different articulations 
+          children of the same notation element or inside the same articulations
+          element. Thus, all three notes should have a staccato and an accent.
+      </miscellaneous-field>
+    </miscellaneous>
+  </identification>
+  <part-list>
+    <score-part id="P1">
+      <part-name>MusicXML Part</part-name>
+    </score-part>
+  </part-list>
+  <!--=========================================================-->
+  <part id="P1">
+    <measure number="1">
+      <attributes>
+        <divisions>4</divisions>
+        <clef>
+          <sign>G</sign>
+          <line>2</line>
+        </clef>
+        <key>
+          <fifths>0</fifths>
+        </key>
+        <time>
+          <beats>3</beats>
+          <beat-type>4</beat-type>
+        </time>
+      </attributes>
+      <note>
+        <pitch>
+          <step>A</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>4</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <accidental>sharp</accidental>
+        <stem>down</stem>
+        <notations>
+          <articulations>
+            <staccato placement="above"/>
+          </articulations>
+        </notations>
+        <notations>
+          <articulations>
+            <accent placement="above"/>
+          </articulations>
+        </notations>
+      </note>
+      <note>
+        <pitch>
+          <step>A</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>4</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <accidental>sharp</accidental>
+        <stem>down</stem>
+        <notations>
+          <articulations>
+            <staccato placement="above"/>
+          </articulations>
+          <articulations>
+            <accent placement="above"/>
+          </articulations>
+        </notations>
+      </note>
+      <note>
+        <pitch>
+          <step>A</step>
+          <octave>4</octave>
+        </pitch>
+        <duration>4</duration>
+        <voice>1</voice>
+        <type>quarter</type>
+        <accidental>sharp</accidental>
+        <stem>down</stem>
+        <notations>
+          <articulations>
+            <staccato placement="above"/>
+            <accent placement="above"/>
+          </articulations>
+        </notations>
+      </note>
+    </measure>
+  </part>
+</score-partwise>
index 3adc084450cdab93e5725074f31452157a223457..d9ebfc3ff6018deceb371d2f788e532b017d3885 100644 (file)
@@ -1157,7 +1157,7 @@ def musicxml_voice_to_lily_voice (voice):
             if voice_builder.current_duration () == 0 and n._duration > 0:
                 voice_builder.set_duration (n._duration)
         
-        notations = n.get_maybe_exist_typed_child (musicxml.Notations)
+        notations_children = n.get_typed_children (musicxml.Notations)
         tuplet_event = None
         span_events = []
 
@@ -1166,7 +1166,7 @@ def musicxml_voice_to_lily_voice (voice):
         #    ornaments | technical | articulations | dynamics |
         #    +fermata | arpeggiate | non-arpeggiate | 
         #    accidental-mark | other-notation
-        if notations:
+        for notations in notations_children:
             if notations.get_tuplet():
                 tuplet_event = notations.get_tuplet()
                 mod = n.get_maybe_exist_typed_child (musicxml.Time_modification)