lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make Completion_heads_engraver respect tuplets and scaling


From: PálBenkő
Subject: make Completion_heads_engraver respect tuplets and scaling
Date: Sat, 1 May 2010 22:58:21 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

hi all,

patch and an example below.

this may look academical, but I need this feature when
transcribing renaissance music - for real life examples see
http://wiki.lilynet.net/index.php/Benkop_projects
the Ockeghem and la Rue examples.

I want to handle rests also; could someone help me
with advice?  in particular, should I add a listen_rest
or handle it fully within note handling?

thanks,
Pal

diff --git a/lily/completion-note-heads-engraver.cc b/lily/completion-note-
heads-engraver.cc
index 3e507ec..fee5791 100644
--- a/lily/completion-note-heads-engraver.cc
+++ b/lily/completion-note-heads-engraver.cc
@@ -87,6 +87,8 @@ class Completion_heads_engraver : public Engraver
   Rational left_to_do_;
   Rational do_nothing_until_;
 
+  Rational factor_;
+
   Moment next_barline_moment ();
   Item *make_note_head (Stream_event*);
 
@@ -187,16 +189,17 @@ Completion_heads_engraver::process_music ()
   Duration note_dur;
   Duration *orig = 0;
   if (left_to_do_)
-    note_dur = Duration (left_to_do_, false);
+    note_dur = Duration (left_to_do_ / factor_, false).compressed (factor_);
   else
     {
       orig = unsmob_duration (note_events_[0]->get_property ("duration"));
       note_dur = *orig;
+      factor_ = note_dur.factor ();
     }
   Moment nb = next_barline_moment ();
   if (nb.main_part_ && nb < note_dur.get_length ())
     {
-      note_dur = Duration (nb.main_part_, false);
+      note_dur = Duration (nb.main_part_ / factor_, false).compressed 
(factor_);
 
       do_nothing_until_ = now.main_part_ + note_dur.get_length ();
     }




\version "2.13.20"

{
  b2 b8 b2. ~ b4. b4
  \set tupletSpannerDuration = #(ly:make-moment 1 1)
  \times 2/3 { b1 b b }
  b2
  \set tupletSpannerDuration = #(ly:make-moment 1 2)
  \times 2/3 { b2 b b }
  b2
  % this still looks silly
  \times 2/3 { b2 b b }
  \set Staff.timeSignatureFraction = #'(6 . 4)
  \scaleDurations #'(2 . 3)
  { b1 b b b4 b\maxima......... b4 b64 }
  \time 4/4
   b\maxima.........
}

\layout
{
  \context
  {
    \Voice
    \remove "Note_heads_engraver"
    \consists "Completion_heads_engraver"
  }
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]