]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #256.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 31 Jan 2007 21:30:38 +0000 (22:30 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 31 Jan 2007 21:30:38 +0000 (22:30 +0100)
Use moment iso. boolean for pending_grace_ in lyric-combine-iterator.cc

input/regression/lyrics-after-grace.ly [new file with mode: 0644]
lily/lyric-combine-music-iterator.cc

diff --git a/input/regression/lyrics-after-grace.ly b/input/regression/lyrics-after-grace.ly
new file mode 100644 (file)
index 0000000..0d5d3d1
--- /dev/null
@@ -0,0 +1,19 @@
+\header
+{
+
+  texidoc = "Lyrics are ignored for aftergrace notes."
+
+}
+
+\version "2.11.13"
+\paper {
+  ragged-right = ##t
+}
+
+<<
+  \new Staff {
+    \new Voice = "myVoice" {
+      \afterGrace c''2 { e''32( } c''2)
+    }}
+  \new Lyrics \lyricsto "myVoice" \lyricmode { foo -- bar }
+>>
index ed2cff898667e2bb936bac8312410e7aaad89b3a..7639e03a8f35dcbbfee034d3dae77f81ae08d768 100644 (file)
@@ -51,13 +51,13 @@ private:
   DECLARE_LISTENER (set_busy);
   DECLARE_LISTENER (check_new_context);
 
-  bool pending_grace_lyric_;
   bool music_found_;
   Context *lyrics_context_;
   Context *music_context_;
   SCM lyricsto_voice_name_;
 
   Moment busy_moment_;
+  Moment pending_grace_moment_;
   
   Music_iterator *lyric_iter_;
 };
@@ -65,7 +65,7 @@ private:
 Lyric_combine_music_iterator::Lyric_combine_music_iterator ()
 {
   music_found_ = false;
-  pending_grace_lyric_ = false;
+  pending_grace_moment_.set_infinite (1);
   lyric_iter_ = 0;
   music_context_ = 0;
   lyrics_context_ = 0;
@@ -86,6 +86,7 @@ Lyric_combine_music_iterator::set_busy (SCM se)
 
   if ((e->in_event_class ("note-event") || e->in_event_class ("cluster-note-event"))
       && music_context_)
+    
     busy_moment_ = max (music_context_->now_mom (),
                        busy_moment_);
   
@@ -254,8 +255,10 @@ Lyric_combine_music_iterator::find_voice ()
 }
 
 void
-Lyric_combine_music_iterator::process (Moment)
+Lyric_combine_music_iterator::process (Moment when)
 {
+  (void) when;
+  
   /* see if associatedVoice has been changed */
   Context *new_voice = find_voice ();
   if (new_voice)
@@ -278,16 +281,21 @@ Lyric_combine_music_iterator::process (Moment)
 
 
   if (music_context_
-      && (start_new_syllable () || pending_grace_lyric_)
+      && (start_new_syllable () ||
+         (busy_moment_ >= pending_grace_moment_))
       && lyric_iter_->ok ())
     {
-      if (music_context_->now_mom ().grace_part_)
+      Moment now = music_context_->now_mom ();
+      if (now.grace_part_)
        {
-         pending_grace_lyric_ = true;
+         pending_grace_moment_ = now;
+         pending_grace_moment_.grace_part_ = Rational (0);
          return;
        }
       else
-       pending_grace_lyric_ = false;
+       {
+         pending_grace_moment_.set_infinite (1);
+       }
       
       Moment m = lyric_iter_->pending_moment ();
       lyrics_context_->set_property (ly_symbol2scm ("associatedVoiceContext"),