]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beaming-pattern.cc
4704: Partially revert 0382ed88: "Adjust beam subdivision"
[lilypond.git] / lily / beaming-pattern.cc
index 4415debf98677e04888299dde09e760479b57245..135438e063c91673825a33326dd630e90be1ea94 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1999--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1999--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -19,6 +19,7 @@
 
 #include "context.hh"
 #include "beaming-pattern.hh"
+#include "misc.hh"
 
 /*
   Represents a stem belonging to a beam. Sometimes (for example, if the stem
@@ -162,16 +163,18 @@ Beaming_pattern::beamify (Beaming_options const &options)
   for (int i = 0; i < 2; i++)
     for (vsize i = 1; i < infos_.size () - 1; i++)
       {
-        Direction non_flag_dir = other_dir (flag_directions[i]);
+        Direction non_flag_dir = -flag_directions[i];
         if (non_flag_dir)
           {
             int importance = infos_[i + 1].rhythmic_importance_;
-            int count = (importance < 0 && options.subdivide_beams_)
-                        ? 1 : min (min (infos_[i].count (non_flag_dir),
+            int start_dur = intlog2(infos_[i+1].start_moment_.main_part_.den());
+            int count = (importance < 0 && options.subdivide_beams_) 
+                        ? max(start_dur,3)-2 // 1/8 note has one beam
+                        : min (min (infos_[i].count (non_flag_dir),
                                         infos_[i + non_flag_dir].count (-non_flag_dir)),
                                    infos_[i - non_flag_dir].count (non_flag_dir));
 
-            infos_[i].beam_count_drul_[non_flag_dir] = count;
+            infos_[i].beam_count_drul_[non_flag_dir] = max(count, 1);
           }
       }
 }