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.
%%% LilyPond-indent-level:4
%%% End:
%% new-chords-done %%
+m
\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
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
\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 }
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;
}
+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.
*/
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));
}
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)
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;
;; 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))