]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 639.
authorJoe Neeman <joeneeman@gmail.com>
Mon, 30 Jun 2008 17:30:19 +0000 (20:30 +0300)
committerJoe Neeman <joeneeman@gmail.com>
Mon, 30 Jun 2008 17:30:19 +0000 (20:30 +0300)
Reinstate subdivideBeams in Beaming_pattern.

lily/beaming-pattern.cc
lily/include/beaming-pattern.hh

index 1841f67900f468f0bea324712ebb0103887ecd56..290620355bbdcfe7b2f037c9635dff65d826f0e8 100644 (file)
@@ -70,7 +70,7 @@ Beam_rhythmic_element::count (Direction d) const
   CENTER.
 */
 Direction
-Beaming_pattern::flag_direction (vsize i) const
+Beaming_pattern::flag_direction (Beaming_options const &options, vsize i) const
 {
   // The extremal stems shouldn't be messed with, so it's appropriate to
   // return CENTER here also.
@@ -81,6 +81,16 @@ Beaming_pattern::flag_direction (vsize i) const
   int left_count = infos_[i-1].count (RIGHT);
   int right_count = infos_[i+1].count (LEFT);
 
+  // If we are told to subdivide beams and we are next to a beat, point the
+  // beamlet away from the beat.
+  if (options.subdivide_beams_)
+    {
+      if (infos_[i].rhythmic_importance_ < 0)
+       return RIGHT;
+      else if (infos_[i+1].rhythmic_importance_ < 0)
+       return LEFT;
+    }
+
   if (count <= left_count && count <= right_count)
     return CENTER;
 
@@ -123,12 +133,12 @@ Beaming_pattern::beamify (Beaming_options const &options)
 
   for (vsize i = 1; i < infos_.size () - 1; i++)
     {
-      Direction non_flag_dir = other_dir (flag_direction (i));
+      Direction non_flag_dir = other_dir (flag_direction (options, i));
       if (non_flag_dir)
        {
          int importance = (non_flag_dir == LEFT)
            ? infos_[i].rhythmic_importance_ : infos_[i+1].rhythmic_importance_;
-         int count = (importance < 0)
+         int count = (importance < 0 && options.subdivide_beams_)
            ? 1 : min (infos_[i].count (non_flag_dir),
                       infos_[i+non_flag_dir].count (-non_flag_dir));
 
index b78ae31a22351a1d595a331befa55efd81b36deb..df21ccc93bcf2c44f32e1795d31a6a32c35f28e7 100644 (file)
@@ -55,7 +55,7 @@ public:
   
 private:
   vector<Beam_rhythmic_element> infos_;
-  Direction flag_direction (vsize) const;
+  Direction flag_direction (Beaming_options const&, vsize) const;
   void find_rhythmic_importance (Beaming_options const&);
   void unbeam_invisible_stems ();
 };