From: Reinhold Kainhofer <reinhold@kainhofer.com>
Date: Tue, 18 Sep 2007 21:12:48 +0000 (+0200)
Subject: MusicXML: Staves with multiple voices get \voiceOne and \voiceTwo
X-Git-Tag: release/2.11.35-1~109
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=0e801f60d59b45e747f876e9ab328b76c7633cd0;p=lilypond.git

MusicXML: Staves with multiple voices get \voiceOne and \voiceTwo

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>
---

diff --git a/python/musicexp.py b/python/musicexp.py
index 40d98aca02..d93d2818be 100644
--- a/python/musicexp.py
+++ b/python/musicexp.py
@@ -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: