beam quants.
* scm/beam.scm (check-quant-callbacks): new function
(check-beam-quant): new function: check whether current beam
quants match argument.
* lily/beam-quanting.cc (score_forbidden_quants): fix problem with
forbidden quant for sitting (upstem)/hanging (downstem) on outer
staffline line.
+2004-07-05 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * input/regression/beam-quant-standard.ly: new file: test standard
+ beam quants.
+
+ * scm/beam.scm (check-quant-callbacks): new function
+ (check-beam-quant): new function: check whether current beam
+ quants match argument.
+
+ * lily/beam-quanting.cc (score_forbidden_quants): fix problem with
+ forbidden quant for sitting (upstem)/hanging (downstem) on outer
+ staffline line.
+
2004-07-04 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ * lily/parser.yy (Generic_prefix_music_scm): add (scm,scm) music functions.
+
* lily/note-collision.cc (do_shifts): align colliding notes to
their leftmost note.
@itemize @bullet
-@item Collisions are now correctly aligned relative to notes in other staves.
+@item Colliding notes are now correctly aligned relative to notes in other staves.
@item An experimental GNOME output backend is available for developers.
It depends on several unreleased packages such as gnome-guile TLA and
Dave Phillips
David Bobroff
David Brandon
+Heinz Stolba
+Kristof Bastiaensen
+Martin Norbäck
Peter Rosenbeck
Stephen Pollei
Bertalan Fodor
Thomas Scharlowski
Yuval Harel
-Martin Norbäck
-Kristof Bastiaensen
Release 2.2
--- /dev/null
+\header {
+
+ texidoc = "This file tests a few standard beam quants."
+
+}
+
+
+%
+% todo: make the check-quant function throw an error for incorrect quants
+%
+
+\paper { raggedright = ##t }
+
+
+%
+% #(ly:set-option 'debug-beam #t)
+
+assertquant =
+#(def-music-function (location l r) (pair? pair?)
+ (let* ((f (check-quant-callbacks l r)))
+
+ #{
+ \override Beam #'position-callbacks = $f
+ #}
+
+))
+
+
+\relative {
+ \assertquant #'(1 . 0) #'(1 . 0)
+ e8[ e]
+ e4
+ e4
+ \assertquant #'(2 . -1) #'(2 . -1)
+ f8[ f]
+ e4
+ e4
+ \assertquant #'(2 . 0) #'(2 . 0)
+ g8[ g]
+ e4
+ e4
+ \assertquant #'(2 . 1) #'(2 . 1)
+ a8[ a]
+ e4 e4 e4
+ \once \override Beam #'inspect-quants = #'(2.2 . 2.2)
+ a8[ a]
+ e4
+ e4
+
+ \assertquant #'(0 . 1) #'(1 . 0)
+ d8[ e]
+ e4
+ e4
+ \assertquant #'(1 . 0) #'(1 . 1)
+ e8[ f]
+ e4
+ e4
+ \assertquant #'(2 . -1) #'(2 . 0)
+ f8[ g]
+ e4
+ e4
+ \assertquant #'(2 . 0) #'(2 . 1)
+ g8[ a]
+ e4
+ e4
+ }
This test is too weak; we should really check all lines.
*/
Direction stem_dir = dirs[d];
- Real gap1 = y[d] - stem_dir * ((j-1) * beam_translation + thickness / 2 - slt/2 );
- Real gap2 = y[d] - stem_dir * (j * beam_translation - thickness / 2 + slt/2);
+
+ /*
+ The 2.2 factor is to provide a little leniency for
+ 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 gap2 = y[d] - stem_dir * (j * beam_translation - thickness / 2 + slt/2.2);
Interval gap;
gap.add_point (gap1);
/*
- grob-scheme.cc --
+ grob-scheme.cc -- Scheme entry points for the grob datatype
source file of the GNU LilyPond music typesetter
{
return MUSIC_FUNCTION_SCM_MUSIC;
}
+ else if (type == ly_symbol2scm ("scm-scm"))
+ {
+ return MUSIC_FUNCTION_SCM_SCM;
+ }
else if (type == ly_symbol2scm ("music-music"))
{
return MUSIC_FUNCTION_MUSIC_MUSIC;
else
{
/* TODO: print location */
- error ("Can not find sigature for music function.");
+ error ("Can not find signature for music function.");
}
return MUSIC_FUNCTION_SCM;
%token <scm> MUSIC_FUNCTION_MUSIC
%token <scm> MUSIC_FUNCTION_MUSIC_MUSIC
%token <scm> MUSIC_FUNCTION_SCM
+%token <scm> MUSIC_FUNCTION_SCM_SCM
%token <scm> MUSIC_FUNCTION_SCM_MUSIC
%token <scm> MUSIC_FUNCTION_SCM_MUSIC_MUSIC
%token <scm> MUSIC_FUNCTION_SCM_SCM_MUSIC
$$ = scm_list_4 ($1, make_input (THIS->pop_spot ()), $3, $4->self_scm ());
scm_gc_unprotect_object ($4->self_scm ());
}
+ | MUSIC_FUNCTION_SCM_SCM {
+ THIS->push_spot ();
+ } embedded_scm embedded_scm {
+ $$ = scm_list_4 ($1, make_input (THIS->pop_spot ()), $3, $4);
+ }
| MUSIC_FUNCTION_MUSIC_MUSIC {
THIS->push_spot ();
} Music Music {
(dir-compare (/ (car total) (car count)) (/ (cdr total) (cdr count)))
(dir-compare (car count) (cdr count))))
+
+(define ((check-beam-quant posl posr) beam)
+ "Check whether BEAM has POSL and POSR quants. POSL are (POSITION
+. QUANT) pairs, where QUANT is -1 (hang), 0 (center), 1 (sit) or -2/ 2 (inter)
+
+"
+ (let*
+ ((posns (ly:grob-property beam 'positions))
+ (thick (ly:grob-property beam 'thickness))
+ (paper (ly:grob-paper beam))
+ (lthick (ly:output-def-lookup paper 'linethickness))
+ (staff-thick lthick) ; fixme.
+ (quant->coord (lambda (p q)
+ (if (= 2 (abs q))
+ (+ p (/ q 4.0))
+ (+ p (- (* 0.5 q thick) (* 0.5 q lthick))))))
+ (want-l (quant->coord (car posl) (cdr posl)))
+ (want-r (quant->coord (car posr) (cdr posr)))
+ (almost-equal (lambda (x y) (< (abs (- x y)) 1e-3))))
+
+ (if (or (not (almost-equal want-l (car posns)))
+ (not (almost-equal want-r (cdr posns))))
+ (ly:warn
+ (format "Error in beam quanting found. Want (~S,~S) found (~S)."
+ want-l want-r posns
+ )))))
+
+(define-public (check-quant-callbacks l r)
+ (list Beam::least_squares
+ Beam::check_concave
+ Beam::slope_damping
+ Beam::shift_region_to_valid
+ Beam::quanting
+ (check-beam-quant l r)
+ ))
+
+
;; 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.