From: hanwen Date: Sun, 4 Jan 2004 00:50:13 +0000 (+0000) Subject: * lily/beam-quanting.cc (quanting): add inspect-quants property: X-Git-Tag: release/2.1.6~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=cef38d72c97768086520c7d1c63b4f278a1959c9;p=lilypond.git * 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 --- diff --git a/ChangeLog b/ChangeLog index 0d33e19b21..d677633909 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-01-04 Han-Wen Nienhuys + * 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 diff --git a/lily/axis-group-engraver.cc b/lily/axis-group-engraver.cc index f2750d7732..b8e5774684 100644 --- a/lily/axis-group-engraver.cc +++ b/lily/axis-group-engraver.cc @@ -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" diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index b4efc0a3bc..e9ce438404 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -12,6 +12,7 @@ #include +#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; diff --git a/lily/beam.cc b/lily/beam.cc index 0db377d090..517896e80c 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -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 diff --git a/lily/scm-option.cc b/lily/scm-option.cc index de3deb0005..9918d1050f 100644 --- a/lily/scm-option.cc +++ b/lily/scm-option.cc @@ -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!")); diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 2392ee9ee3..e54b224c80 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -177,7 +177,7 @@ (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)))) @@ -936,8 +936,8 @@ ;; 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. @@ -946,7 +946,7 @@ (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)