From f2731e17f7fca531ef4c4d0a2d7299592015745a Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sun, 18 Jul 2004 15:19:08 +0000 Subject: [PATCH] * lily/beam-quanting.cc (score_forbidden_quants): make forbidden quant penalty dependent on how much the line is in the gap. * input/regression/grace-stem-length.ly: new file. * lily/beam-quanting.cc (score_forbidden_quants): remove interquant check. The penalty of 1000 is much too harsh, and the inter case should be caught by check-staff-line-in-gap check. * lily/new-slur.cc: cleanup, split in functions. * lily/new-slur.cc (score_encompass): variable head-distance penalty. * lily/new-slur.cc (print): use debug-slur-quanting paper var. --- ChangeLog | 5 +++++ input/regression/grace-stem-length.ly | 24 ++++++++++++++++++++++++ lily/beam-quanting.cc | 18 +++++++++++++++--- lily/beam.cc | 8 ++++---- lily/new-slur.cc | 2 +- 5 files changed, 49 insertions(+), 8 deletions(-) create mode 100644 input/regression/grace-stem-length.ly diff --git a/ChangeLog b/ChangeLog index 907a93b73f..3a9b8e30c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-07-18 Han-Wen Nienhuys + * lily/beam-quanting.cc (score_forbidden_quants): make forbidden + quant penalty dependent on how much the line is in the gap. + + * input/regression/grace-stem-length.ly: new file. + * lily/beam-quanting.cc (score_forbidden_quants): remove interquant check. The penalty of 1000 is much too harsh, and the inter case should be caught by check-staff-line-in-gap check. diff --git a/input/regression/grace-stem-length.ly b/input/regression/grace-stem-length.ly new file mode 100644 index 0000000000..73ca176017 --- /dev/null +++ b/input/regression/grace-stem-length.ly @@ -0,0 +1,24 @@ +\header { + + texidoc = "Stem lengths for grace notes should be shorter than +normal notes, if possible. They should never be longer, even if that +would lead to beam quanting program. " + + } +\version "2.3.6" + +\paper { + raggedright = ##t + +% "debug-beam-quanting" = ##t +} +\relative c'' { + << { d8.\noBeam d16 } \\ >> \grace { d16 } c8.[ b16] + << { c16[ b] } \\ >> + + \grace { c16[ b] } d4 +% \override Beam #'inspect-quants =#'(2.8 . 2.5) +% \grace { c16[ b] } d4 + + } + diff --git a/lily/beam-quanting.cc b/lily/beam-quanting.cc index 0cdba71128..467ef517c3 100644 --- a/lily/beam-quanting.cc +++ b/lily/beam-quanting.cc @@ -454,6 +454,7 @@ Beam::score_forbidden_quants (Real yl, Real yr, Direction d = LEFT; Real dem = 0.0; + do { for (int j = 1; j <= beam_counts[d]; j++) @@ -465,8 +466,8 @@ Beam::score_forbidden_quants (Real yl, Real yr, borderline cases. If we do 2.0, then the upper outer line will be in the gap of the (2,sit) quant, leading to a false demerit. - */ - Real gap1 = y[d] - stem_dir * ((j-1) * beam_translation + thickness / 2 - slt/2.2 ); + */ + Real gap1 = y[d] - stem_dir * ((j-1) * beam_translation + thickness / 2 - slt/2.2 ); Real gap2 = y[d] - stem_dir * (j * beam_translation - thickness / 2 + slt/2.2); Interval gap; @@ -476,7 +477,18 @@ Beam::score_forbidden_quants (Real yl, Real yr, for (Real k = - radius ; k <= radius + BEAM_EPS; k += 1.0) if (gap.contains (k)) - dem += extra_demerit; + { + Real dist = fabs (gap[UP]-k) set_property ("least-squares-dy", - scm_make_real (pos[RIGHT] - pos[LEFT])); + scm_make_real (pos[RIGHT] - pos[LEFT])); } else { diff --git a/lily/new-slur.cc b/lily/new-slur.cc index 828204a5cd..62f9400398 100644 --- a/lily/new-slur.cc +++ b/lily/new-slur.cc @@ -815,7 +815,7 @@ New_slur::score_slopes (Grob * me, Grob *common[], if (!has_beams) /* 0.2: account for staffline offset. - */ + */ demerit += score_param->STEEPER_SLOPE_FACTOR * (dir * (fabs (slur_dy) - fabs (dy + 0.2)) >? 0); demerit += ((fabs (slur_dy/slur_dz[X_AXIS]) - score_param->MAX_SLOPE)>?0) * score_param->MAX_SLOPE_FACTOR; -- 2.39.2