]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/beam-quanting.cc (score_forbidden_quants): make forbidden
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 18 Jul 2004 15:19:08 +0000 (15:19 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 18 Jul 2004 15:19:08 +0000 (15:19 +0000)
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
input/regression/grace-stem-length.ly [new file with mode: 0644]
lily/beam-quanting.cc
lily/beam.cc
lily/new-slur.cc

index 907a93b73f9f425897608d8b5d07972f2d2bc8d3..3a9b8e30c7c754cd74854fc932b871b31c05e714 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-07-18  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * 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 (file)
index 0000000..73ca176
--- /dev/null
@@ -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
+
+           }
+
index 0cdba71128ae172d091809500d56e5e6f47cbfdf..467ef517c3259ddb945b0216f43f572ee7d61119 100644 (file)
@@ -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) <? fabs (gap[DOWN] - k);
+
+               /*
+                 this parameter is tuned to grace-stem-length.ly
+               */
+               Real fixed_demerit = 0.4;
+               
+               dem += extra_demerit
+                 * (fixed_demerit +
+                    (1-fixed_demerit) * (dist / gap.length())* 2);
+             }
        }
     }
   while ((flip (&d))!= LEFT); 
index d884282e61537d4868c773c8b9751ab1abe58b03..e12cd2cdd7ab1e6dd9c79fc6a4e04b25087d4ba4 100644 (file)
@@ -912,11 +912,11 @@ Beam::least_squares (SCM smob)
 
       /*
        For broken beams this doesn't work well. In this case, the
-        slope esp. of the first part of a broken beam should predict
-        where the second part goes.
-       */
+       slope esp. of the first part of a broken beam should predict
+       where the second part goes.
+      */
       me->set_property ("least-squares-dy",
-                            scm_make_real (pos[RIGHT] - pos[LEFT]));
+                       scm_make_real (pos[RIGHT] - pos[LEFT]));
     }
   else
     {
index 828204a5cd75ae51c7ef2c911c37875c30b4e5fb..62f9400398c4a3738e8f241571685272206193d2 100644 (file)
@@ -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;