2 ;;; auto-beam.scm -- Auto-beam-engraver settings
4 ;;; source file of the GNU LilyPond music typesetter
6 ;;; (c) 2000--2003 Jan Nieuwenhuizen <janneke@gnu.org>
9 ;;; specify generic beam begin and end times
13 ;;; function shortest-duration-in-beam time-signature
17 ;;; function = begin or end
18 ;;; shortest-duration-in-beam = numerator denominator; eg: 1 16
19 ;;; time-signature = numerator denominator, eg: 4 4
21 ;;; unspecified or wildcard entries for duration or time-signature
24 ;;; maybe do: '(end shortest-1 16 time-3 4) ?
27 ;;; end beams each 1 2 note
28 ;;; end beams with 16th notes each 1 4 note
29 ;;; end beams with 32th notes each 1 8 note
31 (define-public default-auto-beam-settings
33 ((end * * 3 2) . ,(ly:make-moment 1 2))
34 ((end 1 16 3 2) . ,(ly:make-moment 1 4))
35 ((end 1 32 3 2) . ,(ly:make-moment 1 8))
37 ((begin 1 8 3 4) . ,(ly:make-moment 1 4))
39 ((end * * 3 4) . ,(ly:make-moment 3 4))
40 ((begin 1 16 3 4) . ,(ly:make-moment 1 16))
41 ((end 1 16 3 4) . ,(ly:make-moment 1 4))
42 ;;((begin 1 32 3 4) . ,(ly:make-moment 1 8))
43 ((end 1 32 3 4) . ,(ly:make-moment 1 8))
45 ((begin 1 16 3 8) . ,(ly:make-moment 1 8))
46 ((end * * 3 8) . ,(ly:make-moment 3 8))
49 ;; end beams each 1 2 note
50 ;; end beams with 32th notes each 1 8 note
51 ;; end beams with 1 8 triplets each 1 4 note
53 ((end * * 4 4) . ,(ly:make-moment 1 2))
54 ((end 1 12 4 4) . ,(ly:make-moment 1 4))
55 ((end 1 16 4 4) . ,(ly:make-moment 1 4))
56 ((end 1 32 4 4) . ,(ly:make-moment 1 8))
58 ((end * * 2 4) . ,(ly:make-moment 1 4))
59 ((end 1 12 2 4) . ,(ly:make-moment 1 4))
60 ((end 1 16 2 4) . ,(ly:make-moment 1 4))
61 ((end 1 32 2 4) . ,(ly:make-moment 1 8))
63 ;; It seems that, because of a bug in the previous auto-beamer,
64 ;; we had the effect of this setting x
65 ;; ((end * * 2 8) . ,(ly:make-moment 2 8))
67 ((end * * 4 8) . ,(ly:make-moment 1 4))
68 ((end 1 16 4 8) . ,(ly:make-moment 1 4))
69 ((end 1 32 4 8) . ,(ly:make-moment 1 8))
71 ((end * * 4 16) . ,(ly:make-moment 1 8))
73 ((end * * 6 8) . ,(ly:make-moment 3 8))
74 ((end 1 16 6 8) . ,(ly:make-moment 3 8))
75 ((end 1 32 6 8) . ,(ly:make-moment 1 8))
77 ((end * * 9 8) . ,(ly:make-moment 3 8))
78 ((end 1 16 9 8) . ,(ly:make-moment 3 8))
79 ((end 1 32 9 8) . ,(ly:make-moment 1 8))
81 ((end * * 12 8) . ,(ly:make-moment 3 8))
82 ((end 1 16 12 8) . ,(ly:make-moment 3 8))
83 ((end 1 32 12 8) . ,(ly:make-moment 1 8))
87 (define (override-property-setting context context-prop setting value)
88 "Like the C++ code that executes \\override, but without type
91 (ly:set-context-property! context context-prop
92 (cons (cons setting value)
93 (ly:get-context-property context context-prop)
98 (define (revert-property-setting context setting)
99 "Like the C++ code that executes \revert, but without type
102 (define (revert-assoc alist key)
103 "Return ALIST, with KEY removed. ALIST is not modified, instead
104 a fresh copy of the list-head is made."
107 ((equal? (caar alist) key) (cdr alist))
108 (else (cons (car alist) (revert-assoc alist key)))
113 (ly:set-context-property!
115 (revert-assoc (ly:get-context-property context context-prop)
119 (define-public (override-auto-beam-setting setting num den)
122 (make-apply-context (lambda (c)
123 (override-property-setting
125 setting (ly:make-moment num den))
130 (define-public (revert-auto-beam-setting setting)
133 (make-apply-context (lambda (c)
134 (revert-property-setting