]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Staves with multiple voices get \voiceOne and \voiceTwo
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 18 Sep 2007 21:12:48 +0000 (23:12 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 3 Oct 2007 16:39:46 +0000 (18:39 +0200)
When a staff has more than one voice, we get tons of colliding stems, so
put \voiceOne in the first voice and \voiceTwo in the remaining. This
still breaks with more than two voices, but the majority of cases works
fine now.

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

index 40d98aca0299d477f887fb668451d6ac9409663c..d93d2818bee797e4db95b055bb68512b6e655e02 100644 (file)
@@ -960,8 +960,14 @@ class Staff (StaffGroup):
             else:
                 printer ('\\context Staff << ')
             printer.newline ()
+            n = 0
+            nr_voices = len (voices)
             for [v, lyrics] in voices:
-                printer ('\\context Voice = "%s"  \\%s' % (v,v))
+                n += 1
+                voice_count_text = ''
+                if nr_voices > 1:
+                    voice_count_text = {1: ' \\voiceOne'}.get (n, ' \\voiceTwo')
+                printer ('\\context Voice = "%s" {%s \\%s }' % (v,voice_count_text,v))
                 printer.newline ()
 
                 for l in lyrics: