]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.5.15
authorfred <fred>
Wed, 27 Mar 2002 02:03:18 +0000 (02:03 +0000)
committerfred <fred>
Wed, 27 Mar 2002 02:03:18 +0000 (02:03 +0000)
Documentation/footer.html.in
lily/auto-beam-engraver.cc
lily/beam-engraver.cc
lily/beaming-info.cc
lily/include/beaming.hh
lily/scm-hash.cc
lily/translator.cc

index 8a96551d0c066c763b345c0dbb6634a63011aa34..cfb235d2774102d3aefbb858230498a8f9991160 100644 (file)
@@ -24,7 +24,7 @@ Please send GNU LilyPond questions and comments to
 <p>
 
 Please send comments on these web pages to 
-<a href="mailto:@MAIL_ADDRESS@"><em>@MAIL_ADDRESS@</em></a>
+<a href="mailto:@MAILADDRESS@"><em>@MAILADDRESS@</em></a>
 
 <p>
 
index 97451c6a4ef6da5811bddb7d4c4f211f1636232a..2044f8850010e4d96b6f35f1de0178183ddf86b0 100644 (file)
@@ -291,7 +291,8 @@ Auto_beam_engraver::typeset_beam ()
 {
   if (finished_beam_p_)
     {
-      finished_grouping_p_->beamify ();
+      finished_grouping_p_->beamify(*unsmob_moment (get_property ("beatLength")),
+                                   (bool)gh_scm2bool(get_property("subdivideBeams")));
       Beam::set_beaming (finished_beam_p_, finished_grouping_p_);
       typeset_grob (finished_beam_p_);
       finished_beam_p_ = 0;
index a927a75f05638d515bf6a99d0f297a295aa8914f..b9e7eb63fec08cb961c5221795ca05b9f49d9196 100644 (file)
@@ -181,8 +181,9 @@ Beam_engraver::typeset_beam ()
 {
   if (finished_beam_p_)
     {
-      finished_beam_info_p_->beamify ();
-      
+      finished_beam_info_p_->beamify(*unsmob_moment (get_property ("beatLength")),
+                                    (bool)gh_scm2bool(get_property("subdivideBeams")));
+
       Beam::set_beaming (finished_beam_p_, finished_beam_info_p_);
       typeset_grob (finished_beam_p_);
       delete finished_beam_info_p_;
index 97071ee65ed8bca91c7e1d26e7a370c0c4bc7b28..9eaed377635b3050ea5a01c88a52b4e8ea2a17a2 100644 (file)
@@ -24,23 +24,29 @@ Beaming_info::Beaming_info (Moment m, int i)
 }
 
 const int infinity_i = INT_MAX;        // guh.
+const int at_beat = 1<<15;
 
 int
-Beaming_info_list::min_denominator_index () const
+Beaming_info_list::best_splitpoint_index (Moment &beat_length,bool subdivide) const
 {
   int minden = infinity_i;
   int minidx = -1;
+  Moment beat_pos;
 
   for (int i=1; i < infos_.size (); i++)
     {
-      if (infos_[i].start_mom_.den () < minden)
+      beat_pos = infos_[i].start_mom_ / beat_length;
+      int den = beat_pos.den ();
+      if (infos_[i].beams_i_drul_[LEFT] == infos_[i-1].beams_i_drul_[RIGHT] && !subdivide)
+       den *= 4;
+      if (den < minden)
        {
          minidx = i;
-         minden = infos_[i].start_mom_.den ();
+         minden = den;
        }
     }
 
-  return minidx;
+  return minidx|(minden==1 && subdivide ? at_beat : 0);
 }
 
 int
@@ -56,13 +62,14 @@ Beaming_info_list::beam_extend_count (Direction d) const
 }
 
 void
-Beaming_info_list::beamify ()
+Beaming_info_list::beamify (Moment &beat_length,bool subdivide)
 {
   if (infos_.size () <= 1)
     return;
       
   Drul_array<Beaming_info_list> splits;
-  int m = min_denominator_index ();
+  int m = best_splitpoint_index (beat_length,subdivide);
+  bool split = subdivide && (m & at_beat);  m = m & ~at_beat;
   splits[LEFT].infos_ = infos_.slice (0,m);
   splits[RIGHT].infos_ = infos_.slice (m, infos_.size ());
 
@@ -70,12 +77,13 @@ Beaming_info_list::beamify ()
  
   do
     {
-      splits[d].beamify ();
+      splits[d].beamify (beat_length,subdivide);
     }
   while (flip (&d) != LEFT);
 
-  int middle_beams = splits[RIGHT].beam_extend_count (LEFT) <?
-    splits[LEFT].beam_extend_count (RIGHT);
+  int middle_beams = (split ? 1 :
+                     splits[RIGHT].beam_extend_count (LEFT) <?
+                     splits[LEFT].beam_extend_count (RIGHT));
 
   do
     {
index 6fca4f6a9791d12ddebb09ba2af8f43b46d171e6..e577f604a9dd7fa44cd8b12ccec1270dd4de33ac 100644 (file)
@@ -33,11 +33,10 @@ struct Beaming_info_list
   Array<Beaming_info> infos_;
 
   int beam_extend_count (Direction) const;
-  int min_denominator_index () const;
-  void beamify ();
+  int best_splitpoint_index (Moment &beat_length,bool subdivide) const;
+  void beamify (Moment &beat_length,bool subdivide);
   void add_stem (Moment d, int beams);
 };
 
 
 #endif /* BEAMING_HH */
-
index b8bc8d8d03a28577e4fcecda3ca6b57286eea00d..7eeb67188b0be14174725b23465942b5fe43bc3d 100644 (file)
@@ -14,7 +14,7 @@
 void
 copy_scm_hashes (SCM dest, SCM src)
 {
-  for (int i = SCM_LENGTH(src); i--;)
+  for (int i = SCM_SYMBOL_LENGTH (src); i--;)
     for (SCM s = scm_vector_ref (src, SCM_MAKINUM (i)); ly_pair_p(s); s = ly_cdr (s))
       {
        scm_hashq_set_x (dest, ly_caar (s), ly_cdar (s));
@@ -108,7 +108,7 @@ Scheme_hash_table::set (SCM k, SCM v)
   /*
     resize if getting too large.
   */
-  if (elt_count_ > 2 * SCM_LENGTH (hash_tab_))
+  if (elt_count_ > 2 * SCM_SYMBOL_LENGTH (hash_tab_))
     {
       SCM nh = scm_make_vector (gh_int2scm (3* elt_count_+1), SCM_EOL);
       copy_scm_hashes (nh, hash_tab_);
@@ -142,7 +142,7 @@ SCM
 Scheme_hash_table::to_alist () const
 {
   SCM l = SCM_EOL;
-  for (int i = SCM_LENGTH(hash_tab_); i--;)
+  for (int i = SCM_SYMBOL_LENGTH (hash_tab_); i--;)
     for (SCM s = scm_vector_ref (hash_tab_, gh_int2scm (i)); ly_pair_p(s); s = ly_cdr (s))
       {
        l = scm_acons (ly_caar (s), ly_cdar (s), l);
index 68200445301bf29ae7959af9698122bfec924786..fd9f367df62f796acf4c64007e79288d46e00e10 100644 (file)
@@ -160,7 +160,7 @@ Translator::name (SCM trans)
   if (unsmob_translator (trans))
     {
       char const* nm = classname (unsmob_translator (trans));
-      return gh_str02scm (nm);
+      return ly_str02scm (nm);
     }
   return
     SCM_EOL;