]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Fix regression when adding expressions like octave shifts
authorReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 14 Sep 2007 16:58:35 +0000 (18:58 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 3 Oct 2007 16:39:06 +0000 (18:39 +0200)
Octave shifts in lilypond (like in MusicXML) are not associated with a
particular note but their position in the measure. So far, I simply
inserted them like a note, but unfortunately that reset the current
starting position in the measure (needed to find the correct position
for chords). So I added a method dedicated to inserting such commands
without resetting the position (of course, pending multi-bar rests
still need to be inserted before the music command).

Signed-off-by: Reinhold Kainhofer <reinhold@kainhofer.com>
scripts/musicxml2ly.py

index c82e9ce5897176b3089349c91d877cdacec839d0..454c3330fa4b338d6dac0279b2ae966a999757b1 100644 (file)
@@ -476,6 +476,13 @@ class LilyPondVoiceBuilder:
                 self.elements.append (d)
             self.pending_dynamics = []
 
+    # Insert some music command that does not affect the position in the measure
+    def add_command (self, command):
+        assert isinstance (command, musicexp.Music)
+        if self.pending_multibar > Rational (0):
+            self._insert_multibar ()
+        self.elements.append (command)
+
     def add_dynamics (self, dynamic):
         # store the dynamic item(s) until we encounter the next note/rest:
         self.pending_dynamics.append (dynamic)
@@ -521,7 +528,6 @@ class LilyPondVoiceBuilder:
         else:
             self.jumpto (starting_at)
             value = None
-
         return value
         
     def correct_negative_skip (self, goto):
@@ -549,7 +555,7 @@ def musicxml_voice_to_lily_voice (voice):
                 if a.wait_for_note ():
                     voice_builder.add_dynamics (a)
                 else:
-                    voice_builder.add_music (a, 0)
+                    voice_builder.add_command (a)
             continue
         
         if not n.get_maybe_exist_named_child ('chord'):