]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/beam-quanting.cc (quanting): add inspect-quants property:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 4 Jan 2004 00:50:13 +0000 (00:50 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 4 Jan 2004 00:50:13 +0000 (00:50 +0000)
this shows the demerits of a user-defined beam position pair.

* scm/define-grobs.scm (all-grob-descriptions): set
beamed-extreme-minimum-free-lengths to a different value.

* lily/scm-option.cc: add debug-beam scm-option

ChangeLog
lily/axis-group-engraver.cc
lily/beam-quanting.cc
lily/beam.cc
lily/scm-option.cc
scm/define-grobs.scm

index 0d33e19b215e757d88a11a8559749ac0cd5a983a..d67763390980b5b3a8df399bbc0b5cfe78a82e38 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2004-01-04  Han-Wen Nienhuys   <hanwen@cs.uu.nl>
 
+       * lily/beam-quanting.cc (quanting): add inspect-quants property:
+       this shows the demerits of a user-defined beam position pair.
+
+       * scm/define-grobs.scm (all-grob-descriptions): set
+       beamed-extreme-minimum-free-lengths to a different value.
+
+       * lily/scm-option.cc: add debug-beam scm-option
+
        * mf/feta-bolletjes.mf (overdone_heads): fix stem attachments.
 
 2004-01-03  Han-Wen Nienhuys   <hanwen@cs.uu.nl>
index f2750d77321a38d9c65fcab883ea02b4358a61a6..b8e57746840f1f61225849ba494af285b8314307 100644 (file)
@@ -119,8 +119,14 @@ Axis_group_engraver::add_element (Grob*e)
   Axis_group_interface::add_element (staffline_, e);
 }
 
-////////////////////////////////////////////////////////
-// maybenot such a good idea after all., to put classes in .cc
+/****************************************************************/
+
+/*
+  
+ maybenot such a good idea after all., to put class declarations in
+ .cc
+*/
 
 #include "hara-kiri-group-spanner.hh"
 #include "rhythmic-head.hh"
index b4efc0a3bcd54c2d4b2f9f193bd6798e41c85885..e9ce43840459e77058b2f37996be4b4b9c022f71 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <math.h>
 
+#include "warn.hh"
 #include "grob.hh"
 #include "staff-symbol-referencer.hh"
 #include "beam.hh"
@@ -30,8 +31,8 @@ const int DAMPING_DIRECTIION_PENALTY = 800;
 const int MUSICAL_DIRECTION_FACTOR = 400;
 const int IDEAL_SLOPE_FACTOR = 10;
 
-#define DEBUG_QUANTING 1
-
+// #define DEBUG_QUANTING 1
+extern bool debug_beam_quanting_flag;
 
 static Real
 shrink_extra_weight (Real x, Real fac)
@@ -253,17 +254,44 @@ Beam::quanting (SCM smob)
 
   int best_idx = best_quant_score_idx (qscores);
 
+
+#if DEBUG_QUANTING
+  SCM inspect_quants = me->get_grob_property ("inspect-quants");
+  if (debug_beam_quanting_flag
+      && gh_pair_p (inspect_quants))
+    {
+      Real il = gh_scm2double (gh_car (inspect_quants));
+      Real ir = gh_scm2double (gh_cdr (inspect_quants));
+
+      int i = 0;
+
+      Real mindist = 1e6;
+      for (; i < qscores.size(); i ++)
+       {
+         Real d =fabs (qscores[i].yl-il) + fabs (qscores[i].yr - ir);
+         if (d < mindist)
+           {
+             best_idx = i;
+             mindist= d;
+           }
+       }
+      if (mindist > 1e5)
+       programming_error ("Could not find quant.");
+      else
+       qscores[best_idx].score_card_ += to_string ("i%d", best_idx);
+    }
+#endif
   
   me->set_grob_property ("positions",
                         gh_cons (gh_double2scm (qscores[best_idx].yl),
-                                 gh_double2scm (qscores[best_idx].yr))
-                        );
-
+                                 gh_double2scm (qscores[best_idx].yr)));
 #if DEBUG_QUANTING
-  // debug quanting
-  me->set_grob_property ("quant-score",
-                        scm_makfrom0str (qscores[best_idx].score_card_.to_str0 ()));
-  me->set_grob_property ("best-idx", scm_int2num (best_idx));
+  if (debug_beam_quanting_flag)
+    {
+      // debug quanting
+      me->set_grob_property ("quant-score",
+                            scm_makfrom0str (qscores[best_idx].score_card_.to_str0 ()));
+    }
 #endif
 
   return SCM_UNSPECIFIED;
index 0db377d09044b071f24b17e991b8a258e896e877..517896e80c7965a271c06a8fb21b88b17679d272 100644 (file)
@@ -46,6 +46,8 @@ Notes:
 
 #define DEBUG_QUANTING 1
 
+bool debug_beam_quanting_flag;
+
 
 #if DEBUG_QUANTING
 #include "text-item.hh"  // debug output.
@@ -485,6 +487,7 @@ Beam::brew_molecule (SCM grob)
   the_beam.translate_axis (pos[LEFT], Y_AXIS);
 
 #if (DEBUG_QUANTING)
+  if (debug_beam_quanting_flag)
     {
       /*
        This code prints the demerits for each beam. Perhaps this
index de3deb00051dc9463fe2c0259324b7356d59e7ce..9918d1050fc9d50df9602477e6e86a9469a7869e 100644 (file)
@@ -133,6 +133,11 @@ LY_DEFINE (ly_set_option, "ly:set-option", 1, 1, 0, (SCM var, SCM val),
     {
       lily_1_8_relative = false;
     }
+  else if (var == ly_symbol2scm ("debug-beam"))
+    {
+      extern bool debug_beam_quanting_flag;
+      debug_beam_quanting_flag = true;
+    }
   else
     {
       warning (_("Unknown internal option!"));
index 2392ee9ee3d70e259601f19b753552fcaa75cfbe..e54b224c802b6ea47b3da79a47fb43d5ce64f1d4 100644 (file)
        (auto-knee-gap . 5.5)
 
        ;; only for debugging.
-       (font-name . "cmr10")
+       (font-family . roman)
        
        (space-function . ,Beam::space_function)
        (meta . ((interfaces . (staff-symbol-referencer-interface beam-interface spanner-interface))))
 
        ;; FIXME this should come from 'lengths
 
-       (beamed-lengths . (3.26 3.26 1.5))
-;      (beamed-lengths . (3.5 3.5 3.5 4.5 5.0))
+;      (beamed-lengths . (3.26 3.26 1.5))
+       (beamed-lengths . (3.5 3.5 3.5 4.5 5.0))
        
        ;; We use the normal minima as minimum for the ideal lengths,
        ;; and the extreme minima as abolute minimum length.
        (beamed-minimum-free-lengths . (1.83 1.5 1.25))
        
        ;; The 'extreme case' minima
-       (beamed-extreme-minimum-free-lengths . (2.5 2.0 1.0))
+       (beamed-extreme-minimum-free-lengths . (2.0 1.25))
 
        (X-offset-callbacks . (,Stem::off_callback))
        (X-extent-callback . ,Stem::dim_callback)