From 96bbfd1af93dc31101d0b3eb0399387f43544a3b Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Fri, 14 Sep 2007 18:58:35 +0200 Subject: [PATCH] MusicXML: Fix regression when adding expressions like octave shifts 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 --- scripts/musicxml2ly.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/musicxml2ly.py b/scripts/musicxml2ly.py index c82e9ce589..454c3330fa 100644 --- a/scripts/musicxml2ly.py +++ b/scripts/musicxml2ly.py @@ -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'): -- 2.39.5