]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/beam.cc (set_minimum_dy): new function. Round non-zero
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 12 Sep 2004 12:27:23 +0000 (12:27 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 12 Sep 2004 12:27:23 +0000 (12:27 +0000)
small slope up to smallest quant. This prevents small slopes from
getting rounded to zero.

* lily/beam-quanting.cc (quanting): don't allow dy_mus slopes that
are smaller than the smallest quant.

* scm/define-grobs.scm (all-grob-descriptions): fix order of
key-cancellation.

This fixes: morgenlied.ly and input/regression/beam-concave.ly

ChangeLog
input/les-nereides.ly
input/regression/beam-quant-standard.ly
lily/beam-quanting.cc
lily/beam.cc
scm/define-grobs.scm

index 0445e8900ef78b278fe1f42d083bda9dc91c95ab..7899fe030e74ca3e57441b3602b347b242f4098a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2004-09-12  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/beam.cc (set_minimum_dy): new function. Round non-zero
+       small slope up to smallest quant. This prevents small slopes from
+       getting rounded to zero.
+
+       * lily/beam-quanting.cc (quanting): don't allow dy_mus slopes that
+       are smaller than the smallest quant.
+
        * input/tutorial/brahms*.ly: remove.
 
        * input/*: update all .ly files.
index a20d14aef4aef54a3e1abf34ed6d2776ba8b0ab7..7e155716c2ebb58b20ae5f353bd5ff1381f8b227 100644 (file)
@@ -302,3 +302,4 @@ theScore = \score{
 %%% LilyPond-indent-level:4
 %%% End:
 %% new-chords-done %%
+m
index 942fbbcee675a02324d57f71258e692e158a20b9..c6d2f8d3878da13972bd47fb7b2cd4165c2d1d78 100644 (file)
@@ -6,21 +6,22 @@
 
 \version "2.3.16"
 
-%
-% todo: make the check-quant function throw an error for incorrect quants
-%
-
 \paper  {
     raggedright = ##t
     #(define debug-beam-quanting #t)
 
       }
 
-filler = \relative { e4 e }
+filler = \new Voice \relative  {
+    \hideNotes
+    e4 e
+}
 % 
 
-
+%%
+%% Ross p108--112
 primes = \relative {
+    \time 3/4 
     \assertBeamQuant #'(0 . 0)  #'(0 . 0)
     c8[ c]
     \filler
@@ -48,13 +49,30 @@ primes = \relative {
     a8[ a]
     \filler
       
+%{
     \once \override Beam #'inspect-quants = #'(2.2 . 2.2)
+    \assertBeamQuant 
     a8[ a]
     \filler
+    
+%}
+    
 }
 
+
 seconds = \relative {
-    \assertBeamQuant #'(0 . 1)  #'(0 . 1)
+    
+    \assertBeamQuant #'(0 . 0)  #'(0 . 1)
+    a8[ b]
+    \filler
+     
+
+    \assertBeamQuant #'(0 . 0)  #'(0 . 1)
+    b8[ c]
+    \filler
+     
+
+    \assertBeamQuant #'(0 . 0)  #'(0 . 1)
     c8[ d]
     \filler
      
@@ -82,6 +100,45 @@ seconds = \relative {
     \filler
 }
 
+filler = \new Voice \relative  {
+    \hideNotes
+    e4 e4.
+}
+
+% Ross, p122 
+primeSixteenths = \relative {
+    \stemUp
+    \assertBeamQuant #'(0 . -1)  #'(0 . -1)
+    g16[ g]
+    \filler
+    \assertBeamQuant #'(0 . -1)  #'(0 . -1)
+    a16[ a]
+    \filler
+    \assertBeamQuant #'(0 . -1)  #'(0 . -1)
+    b16[ b]
+    \filler
+    \assertBeamQuant #'(0 . 0)  #'(0 . 0)
+    c16[ c]
+    \filler
+    \assertBeamQuant #'(1 . -1)  #'(1 . -1)
+    d16[ d]
+    \filler
+    \assertBeamQuant #'(1 . 0)  #'(1 . 0)
+    e16[ e]
+    \filler
+    \assertBeamQuant #'(2 .  -1)  #'(2 . -1)
+    f16[ f]
+    \filler
+    \assertBeamQuant #'(2 . 0)  #'(2 . 0)
+    g16[ g]
+    \filler
+    \assertBeamQuant #'(3 . -1)  #'(3 . -1)
+    a16[ a]
+    \filler
+    \assertBeamQuant #'(3 . 0)  #'(3 . 0)
+    b16[ b]
+    \filler
+}
 
-{ \primes \seconds }
+{ \primes \seconds \primeSixteenths }
 
index 6a8721fdca1a2fffb46b344798687cac442c228c..7dea6076607d517768031ee812942c5d2e512e48 100644 (file)
@@ -106,14 +106,14 @@ Beam::quanting (SCM smob)
   Real thickness = Beam::get_thickness (me) / ss ;
   Real slt = Staff_symbol_referencer::line_thickness (me) / ss;
 
-  SCM sdy = me->get_property ("least-squares-dy");
-  Real dy_mus = scm_is_number (sdy) ? scm_to_double (sdy) : 0.0;
-  
+  Real dy_mus = robust_scm2double (me->get_property ("least-squares-dy"), 0);
   Real straddle = 0.0;
   Real sit = (thickness - slt) / 2;
   Real inter = 0.5;
   Real hang = 1.0 - (thickness - slt) / 2;
   Real quants [] = {straddle, sit, inter, hang };
+
+
   
   int num_quants = int (sizeof (quants)/sizeof (Real));
   Array<Real> quantsl;
index d8648dc26c29a676b872eb834ab7682e80ecfb75..9b71b10331057076c8945abe4af90c3979bfb1bc 100644 (file)
@@ -836,6 +836,29 @@ Beam::position_beam (Grob *me)
 }
 
 
+void
+set_minimum_dy (Grob *me, Real * dy)
+{
+  if (*dy)
+    {
+      /*
+       If dy is smaller than the smallest quant, we
+       get absurd direction-sign penalties. 
+      */
+         
+      Real ss = Staff_symbol_referencer::staff_space (me);
+      Real thickness = Beam::get_thickness (me) / ss ;
+      Real slt = Staff_symbol_referencer::line_thickness (me) / ss;
+      Real sit = (thickness - slt) / 2;
+      Real inter = 0.5;
+      Real hang = 1.0 - (thickness - slt) / 2;
+         
+      *dy = sign (*dy) * (fabs (*dy)
+                       >?
+                       (sit <? inter <? hang));
+    }
+}
+
 /*
   Compute  a first approximation to the beam slope.
  */
@@ -935,6 +958,8 @@ Beam::least_squares (SCM smob)
       minimise_least_squares (&slope, &y, ideals);
 
       dy = slope * dx;
+
+      set_minimum_dy (me,&dy);
       me->set_property ("least-squares-dy", scm_make_real (dy));
       pos = Interval (y, (y+dy));
     }
@@ -954,10 +979,10 @@ Beam::least_squares (SCM smob)
   We can't combine with previous function, since check concave and
   slope damping comes first.
 
-TODO: we should use the concaveness to control the amount of damping
-applied.
+  TODO: we should use the concaveness to control the amount of damping
+  applied.
   
- */
+*/
 MAKE_SCHEME_CALLBACK (Beam, shift_region_to_valid, 1);
 SCM
 Beam::shift_region_to_valid (SCM grob)
@@ -1091,6 +1116,9 @@ Beam::slope_damping (SCM smob)
       slope = 0.6 * tanh (slope) / (damping + concaveness);
 
       Real damped_dy = slope * dx;
+
+      set_minimum_dy (me, &damped_dy);
+      
       pos[LEFT] += (dy - damped_dy) / 2;
       pos[RIGHT] -= (dy - damped_dy) / 2;
 
index 7ce7c91608ca79a79ec4f207b00e0c536848ed75..80210c8ba97c2cd22b6d9a44806c53607ce0fcbd 100644 (file)
 
        ;; FIXME this should come from 'lengths
 
-       (beamed-lengths . (3.26 3.26 1.5))
+       (beamed-lengths . (3.26 3.5 3.6))
        
        ;; We use the normal minima as minimum for the ideal lengths,
        ;; and the extreme minima as abolute minimum length.
        
        ;; The 'normal' minima
        (beamed-minimum-free-lengths . (1.83 1.5 1.25))
+       ;(beamed-minimum-free-lengths . (2.0 1.83 1.25))
        
        ;; The 'extreme case' minima
        (beamed-extreme-minimum-free-lengths . (2.0 1.25))