1 ;;;; auto-beam.scm -- Auto-beam-engraver settings
3 ;;;; source file of the GNU LilyPond music typesetter
5 ;;;; (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
7 ;;; specify generic beam begin and end times
11 ;;; function shortest-duration-in-beam time-signature
15 ;;; function = begin or end
16 ;;; shortest-duration-in-beam = numerator denominator; e.g.: 1 16
17 ;;; time-signature = numerator denominator, e.g.: 4 4
19 ;;; unspecified or wildcard entries for duration or time-signature
22 ;;; maybe do: '(end shortest-1 16 time-3 4) ?
25 ;;; end beams each 1 2 note
26 ;;; end beams with 16th notes each 1 4 note
27 ;;; end beams with 32th notes each 1 8 note
29 (define-public default-auto-beam-settings
31 ((end * * 3 2) . ,(ly:make-moment 1 2))
32 ((end 1 16 3 2) . ,(ly:make-moment 1 4))
33 ((end 1 32 3 2) . ,(ly:make-moment 1 8))
35 ((begin 1 8 3 4) . ,(ly:make-moment 1 4))
37 ((end * * 3 4) . ,(ly:make-moment 3 4))
38 ((begin 1 16 3 4) . ,(ly:make-moment 1 16))
39 ((end 1 16 3 4) . ,(ly:make-moment 1 4))
40 ;;((begin 1 32 3 4) . ,(ly:make-moment 1 8))
41 ((end 1 32 3 4) . ,(ly:make-moment 1 8))
43 ((begin 1 16 3 8) . ,(ly:make-moment 1 8))
44 ((end * * 3 8) . ,(ly:make-moment 3 8))
47 ;; end beams each 1 2 note
48 ;; end beams with 32th notes each 1 8 note
49 ;; end beams with 1 8 triplets each 1 4 note
51 ((end * * 4 4) . ,(ly:make-moment 1 2))
52 ((end 1 12 4 4) . ,(ly:make-moment 1 4))
53 ((end 1 16 4 4) . ,(ly:make-moment 1 4))
54 ((end 1 32 4 4) . ,(ly:make-moment 1 8))
56 ((end * * 2 4) . ,(ly:make-moment 1 4))
57 ((end 1 12 2 4) . ,(ly:make-moment 1 4))
58 ((end 1 16 2 4) . ,(ly:make-moment 1 4))
59 ((end 1 32 2 4) . ,(ly:make-moment 1 8))
61 ;; It seems that, because of a bug in the previous auto-beamer,
62 ;; we had the effect of this setting x
63 ;; ((end * * 2 8) . ,(ly:make-moment 2 8))
65 ((end * * 4 8) . ,(ly:make-moment 1 4))
66 ((end 1 16 4 8) . ,(ly:make-moment 1 4))
67 ((end 1 32 4 8) . ,(ly:make-moment 1 8))
69 ((end * * 4 16) . ,(ly:make-moment 1 8))
71 ((end * * 6 8) . ,(ly:make-moment 3 8))
72 ((end 1 16 6 8) . ,(ly:make-moment 3 8))
73 ((end 1 32 6 8) . ,(ly:make-moment 1 8))
75 ((end * * 9 8) . ,(ly:make-moment 3 8))
76 ((end 1 16 9 8) . ,(ly:make-moment 3 8))
77 ((end 1 32 9 8) . ,(ly:make-moment 1 8))
79 ((end * * 12 8) . ,(ly:make-moment 3 8))
80 ((end 1 16 12 8) . ,(ly:make-moment 3 8))
81 ((end 1 32 12 8) . ,(ly:make-moment 1 8))
85 (define (override-property-setting context context-prop setting value)
86 "Like the C++ code that executes \\override, but without type
89 (ly:context-set-property! context context-prop
90 (cons (cons setting value)
91 (ly:context-property context context-prop)
96 (define (revert-property-setting context setting)
97 "Like the C++ code that executes \revert, but without type
100 (define (revert-assoc alist key)
101 "Return ALIST, with KEY removed. ALIST is not modified, instead
102 a fresh copy of the list-head is made."
105 ((equal? (caar alist) key) (cdr alist))
106 (else (cons (car alist) (revert-assoc alist key)))
111 (ly:context-set-property!
113 (revert-assoc (ly:context-property context context-prop)
117 (define-public (override-auto-beam-setting setting num den . rest)
120 (make-apply-context (lambda (c)
121 (override-property-setting
123 setting (ly:make-moment num den))
125 (if (and (pair? rest) (symbol? (car rest)))
130 (define-public (revert-auto-beam-setting setting . rest)
133 (make-apply-context (lambda (c)
134 (revert-property-setting
137 (if (and (pair? rest) (symbol? (car rest)))