lilypond-devel
[Top][All Lists]
Advanced

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

Fix beaming-pattern for compound meters (issue 5545067)


From: Carl . D . Sorensen
Subject: Fix beaming-pattern for compound meters (issue 5545067)
Date: Mon, 16 Jan 2012 20:10:48 +0000

Reviewers: ,

Message:
Here's an attempt at fixing issue 2228, where beamlets in compound
meters don't point in the right direction.

Please review.


Description:
Fix beaming-pattern for compound meters

Please review this at http://codereview.appspot.com/5545067/

Affected files:
  M lily/beaming-pattern.cc


Index: lily/beaming-pattern.cc
diff --git a/lily/beaming-pattern.cc b/lily/beaming-pattern.cc
index 2db441ef690d347f4436efeec704e0a6e2cdc2a5..1e7ff0a0a3c79705fa3c901132a061e977d3c212 100644
--- a/lily/beaming-pattern.cc
+++ b/lily/beaming-pattern.cc
@@ -187,11 +187,12 @@ update_tuplet (Moment start_moment, Rational factor, Moment *tuplet_start_moment
 void
 find_location (SCM grouping, Moment base_moment, Moment start_moment,
                Rational factor, Moment *group_pos, Moment *next_group_pos,
-               Moment *next_beat_pos)
+               Moment *next_beat_pos, Moment *group_size)
 {
   *group_pos = Moment (0);
   *next_group_pos = Moment (0);
   *next_beat_pos = base_moment;
+  *group_size = base_moment;

   while (*next_beat_pos <= start_moment)
     *next_beat_pos += base_moment;
@@ -203,6 +204,7 @@ find_location (SCM grouping, Moment base_moment, Moment start_moment,
         {
           group_count = scm_to_int (scm_car (grouping));
           grouping = scm_cdr (grouping);
+          *group_size = group_count * base_moment;
         }

       // If we have a tuplet, the count should be determined from
@@ -227,6 +229,7 @@ Beaming_pattern::find_rhythmic_importance (Beaming_options const &options)
   Moment group_pos (0);  // 0 is the start of the first group
   Moment next_group_pos (0);
   Moment next_beat_pos (options.base_moment_);
+  Moment group_size (options.base_moment_);
   Moment tuplet_start_moment (-1, 1);
   int tuplet_number = 1;

@@ -236,7 +239,8 @@ Beaming_pattern::find_rhythmic_importance (Beaming_options const &options)
   // Find where we are in the beat structure of the measure
   if (infos_.size ())
     find_location (grouping, options.base_moment_, infos_[i].start_moment_,
- infos_[i].factor_, &group_pos, &next_group_pos, &next_beat_pos);
+                   infos_[i].factor_, &group_pos, &next_group_pos,
+                   &next_beat_pos, &group_size);

   // Mark the importance of stems that start at a beat or a beat group.
   while (i < infos_.size ())
@@ -245,7 +249,8 @@ Beaming_pattern::find_rhythmic_importance (Beaming_options const &options)
           || (infos_[i].start_moment_ > next_beat_pos))
         // Find the new group ending point
find_location (grouping, options.base_moment_, infos_[i].start_moment_, - infos_[i].factor_, &group_pos, &next_group_pos, &next_beat_pos);
+                       infos_[i].factor_, &group_pos, &next_group_pos,
+                       &next_beat_pos, &group_size);
       // Mark the start of this beat group
       if (infos_[i].start_moment_ == group_pos)
         infos_[i].rhythmic_importance_ = -2;
@@ -262,7 +267,8 @@ Beaming_pattern::find_rhythmic_importance (Beaming_options const &options) // set the beat end (if not in a tuplet) and increment the next beat if (tuplet_number == 1 && infos_[i].start_moment_ == next_beat_pos)
             {
-              infos_[i].rhythmic_importance_ = -1;
+              if (options.subdivide_beams_)
+                infos_[i].rhythmic_importance_ = -1;
               next_beat_pos += options.base_moment_;
             }
// The rhythmic importance of a stem between beats depends on its fraction @@ -271,7 +277,7 @@ Beaming_pattern::find_rhythmic_importance (Beaming_options const &options)
           // the fraction of the tuplet, instead of the fraction of
           // a beat.
           Moment ratio = (tuplet_number == 1)
-                           ? dt / options.base_moment_
+                           ? dt / group_size
                            : tuplet_dt / Moment (1, 8)  / tuplet_moment;
           if (infos_[i].rhythmic_importance_ >= 0)
             infos_[i].rhythmic_importance_ = (int) ratio.den ();





reply via email to

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