]> git.donarmstrong.com Git - lilypond.git/commitdiff
Midi: add addlyrics test with mid2ly fix.
authorJan Nieuwenhuizen <janneke@gnu.org>
Mon, 14 Mar 2011 14:16:48 +0000 (15:16 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Mon, 14 Mar 2011 14:19:04 +0000 (15:19 +0100)
input/regression/midi/lyrics-addlyrics.ly [new file with mode: 0644]
lily/staff-performer.cc
scripts/midi2ly.py

diff --git a/input/regression/midi/lyrics-addlyrics.ly b/input/regression/midi/lyrics-addlyrics.ly
new file mode 100644 (file)
index 0000000..c8a08e4
--- /dev/null
@@ -0,0 +1,34 @@
+% Lily was here -- automatically converted by ../../../scripts/midi2ly.py from out/initial-key.midi
+\version "2.13.53"
+
+\layout {
+  \context {
+    \Voice
+    \remove "Note_heads_engraver"
+    \consists "Completion_heads_engraver"
+    \remove "Rest_engraver"
+    \consists "Completion_rest_engraver"
+  }
+}
+
+% included from ./out/initial-key.header
+\header {
+texidoc="Lyrics are preserved"
+options=""
+}
+% end
+
+\score {
+  <<
+    \relative c'' {
+      \key g \major
+      \time 6/8
+      d4 b8 c4 a8 | d4 b8 g4
+    }
+    \addlyrics {
+      Girls and boys come | out to play,
+    }
+  >>
+  \layout {}
+  \midi {}
+}
index 7239e58d4e4501f77df7486d1e101aa134c13980..df2697060bff31ad56f5755870ab84ab96be1925 100644 (file)
@@ -105,9 +105,13 @@ Audio_staff*
 Staff_performer::new_audio_staff (string voice)
 {
   Audio_staff* audio_staff = new Audio_staff;
-  name_ = new Audio_text (Audio_text::TRACK_NAME, context ()->id_string ()
-                         + ":" + voice);
-  audio_staff->add_audio_item (name_);
+  string track_name = context ()->id_string () + ":" + voice;
+  if (track_name != ":")
+    {
+      name_ = new Audio_text (Audio_text::TRACK_NAME, context ()->id_string ()
+                             + ":" + voice);
+      audio_staff->add_audio_item (name_);
+    }
   announce_element (Audio_element_info (audio_staff, 0));
   announce_element (Audio_element_info (name_, 0));
   staff_map_[voice] = audio_staff;
@@ -118,7 +122,7 @@ Audio_staff*
 Staff_performer::get_audio_staff (string voice)
 {
   SCM channel_mapping = get_property ("midiChannelMapping");
-  if (channel_mapping == ly_symbol2scm ("voice")
+  if (channel_mapping != ly_symbol2scm ("voice")
       && staff_map_.size ())
     return staff_map_.begin ()->second;
 
index 4e026f5198b751c59707ded378844edd1627d615..a4ed761448fdaaddbc471d259ac37f43220a1060 100644 (file)
@@ -497,7 +497,9 @@ class Channel:
                     global_options.key = k
 
                 elif (e[1][1] == midi.LYRIC
-                      or (global_options.text_lyrics and e[1][1] == midi.TEXT_EVENT)):
+                      or (global_options.text_lyrics
+                          and e[1][1] == midi.TEXT_EVENT)):
+                    self.lyrics_p_ = True
                     if last_lyric:
                         last_lyric.clocks = t - last_time
                         music.append ((last_time, last_lyric))
@@ -538,6 +540,7 @@ class Track (Channel):
         Channel.__init__ (self, None)
         self.name = None
         self.channels = {}
+        self.lyrics_p_ = False
     def _add (self, event):
         self.events.append (event)
     def add (self, event, channel=None):