]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #578.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 1 May 2008 19:23:17 +0000 (16:23 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 1 May 2008 19:23:17 +0000 (16:23 -0300)
3 unrelated fixes:

 - correctly schedule timestamp of next event in
   Completion_heads_engraver

 - Add a melisma property completionBusy, and write it in
   Completion_heads_engraver

 - Override length of the generated note head too, so the busyGrobs
   list is correctly calculated.

input/regression/completion-heads-lyrics.ly [new file with mode: 0644]
lily/completion-note-heads-engraver.cc
lily/lyric-combine-music-iterator.cc
scm/define-context-properties.scm

diff --git a/input/regression/completion-heads-lyrics.ly b/input/regression/completion-heads-lyrics.ly
new file mode 100644 (file)
index 0000000..0df5fcd
--- /dev/null
@@ -0,0 +1,25 @@
+\header {
+  texidoc = "You can put lyrics under completion heads."
+}
+\version "2.11.45"
+
+mel = \relative c'' {
+ c1. c1.
+}
+
+lyr = \lyricmode {
+ One  two
+}
+
+\score {
+ \new Score <<
+   \new Staff <<
+     \new Voice = "completion" \with {
+       \remove "Note_heads_engraver"
+       \remove "Forbid_line_break_engraver"
+       \consists "Completion_heads_engraver"
+     } \mel
+   >>
+   \new Lyrics \lyricsto "completion" \lyr
+ >>
+}
index a83c961727578ab5951a96d73e997ac83a369170..8734b861c2a2d15eadb9b7367b508da6200619fa 100644 (file)
@@ -166,6 +166,7 @@ Completion_heads_engraver::process_music ()
 
       event->set_property ("pitch", pits);
       event->set_property ("duration", note_dur.smobbed_copy ());
+      event->set_property ("length", Moment (note_dur.get_length ()).smobbed_copy ());
       event->set_property ("duration-log", scm_from_int (note_dur.duration_log ()));
 
       Item *note = make_note_head (event);
@@ -187,9 +188,8 @@ Completion_heads_engraver::process_music ()
     }
 
   left_to_do_ -= note_dur.get_length ();
-
   if (left_to_do_)
-    get_global_context ()->add_moment_to_process (now.main_part_ + left_to_do_);
+    get_global_context ()->add_moment_to_process (now.main_part_ + note_dur.get_length());
   /*
     don't do complicated arithmetic with grace notes.
   */
@@ -217,6 +217,8 @@ Completion_heads_engraver::start_translation_timestep ()
       note_events_.clear ();
       prev_notes_.clear ();
     }
+  context ()->set_property ("completionBusy",
+                           ly_bool2scm (note_events_.size ()));
 }
 
 Completion_heads_engraver::Completion_heads_engraver ()
@@ -240,5 +242,5 @@ ADD_TRANSLATOR (Completion_heads_engraver,
                "measureLength ",
 
                /* write */
-               ""
+               "completionBusy "
                );
index bf5d02d8b2876a2b1d154c2064cbab0f9d17bff9..c80fe02998b420660802cb8816d3ee5515daaecc 100644 (file)
@@ -97,13 +97,15 @@ Lyric_combine_music_iterator::set_music_context (Context *to)
 {
   if (music_context_)
     {
-      music_context_->event_source ()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
+      music_context_->event_source ()->
+       remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
     }
 
   music_context_ = to;
   if (to)
     {
-      to->event_source ()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("music-event"));
+      to->event_source ()->add_listener (GET_LISTENER (set_busy),
+                                        ly_symbol2scm ("music-event"));
     }
 }
 
index e506ed24fea8a978dffb9be277b99910a9374c92..f656942b1630e769a87b4f549201e2271bc7b56c 100644 (file)
@@ -148,6 +148,7 @@ Values of 7 and -7 are common.")
      (clefPosition ,number? "Where should the center of the clef
 symbol go, measured in half staff spaces from the center of the
 staff.")
+     (completionBusy ,boolean? "Whether a completion-note head is playing.")
      (connectArpeggios ,boolean? "If set, connect arpeggios across
 piano staff.")
      (countPercentRepeats ,boolean? "If set, produce counters for
@@ -581,4 +582,4 @@ and subscripts.  See @file{scm/script.scm} for more information.")
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (define-public default-melisma-properties
-  '(melismaBusy slurMelismaBusy tieMelismaBusy beamMelismaBusy))
+  '(melismaBusy slurMelismaBusy tieMelismaBusy beamMelismaBusy completionBusy))