]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/beaming-pattern.cc
Doc: Usage - OOoLilyPond only works up to v4
[lilypond.git] / lily / beaming-pattern.cc
index 4415debf98677e04888299dde09e760479b57245..cb8c91dbece9de761ba7a5d1421e4f5e8c12987c 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
@@ -131,6 +132,8 @@ Beaming_pattern::beamify (Beaming_options const &options)
   if (infos_.size () <= 1)
     return;
 
+  int subdivide_beam_count = intlog2(options.base_moment_.main_part_.den())-2;
+
   unbeam_invisible_stems ();
 
   if (infos_[0].start_moment_.grace_part_)
@@ -166,8 +169,9 @@ Beaming_pattern::beamify (Beaming_options const &options)
         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 count = (importance < 0 && options.subdivide_beams_) 
+                        ? subdivide_beam_count
+                        : 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));