1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 1998--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
4 ;;;; Jan Nieuwenhuizen <janneke@gnu.org>
5 ;;;; Neil Puttock <n.puttock@gmail.com>
6 ;;;; Carl Sorensen <c_sorensen@byu.edu>
8 ;;;; LilyPond is free software: you can redistribute it and/or modify
9 ;;;; it under the terms of the GNU General Public License as published by
10 ;;;; the Free Software Foundation, either version 3 of the License, or
11 ;;;; (at your option) any later version.
13 ;;;; LilyPond is distributed in the hope that it will be useful,
14 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;;; GNU General Public License for more details.
18 ;;;; You should have received a copy of the GNU General Public License
19 ;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
21 ;; TODO: should link back into user manual.
23 (define (mm-rest-child-list music)
24 "Generate events for multimeasure rests,
25 to be used by the sequential-iterator"
26 (let ((location (ly:music-property music 'origin))
27 (duration (ly:music-property music 'duration)))
28 (list (make-music 'BarCheck
30 (make-event-chord (cons (make-music 'MultiMeasureRestEvent
33 (ly:music-property music 'articulations)))
37 (define (make-volta-set music)
38 (let* ((alts (ly:music-property music 'elements))
40 (times (ly:music-property music 'repeat-count)))
45 ;; set properties for proper bar numbering
47 (list (make-music 'AlternativeEvent
48 'alternative-dir (if (= y 0)
51 'alternative-increment
58 (list (make-music 'AlternativeEvent
60 'alternative-increment 0))
65 (define (make-ottava-set music)
66 "Set context properties for an ottava bracket."
67 (let ((octavation (ly:music-property music 'ottava-number)))
69 (list (context-spec-music
72 (let ((offset (* -7 octavation))
73 (string (assoc-get octavation '((2 . "15ma")
78 (set! (ly:context-property context 'middleCOffset) offset)
79 (set! (ly:context-property context 'ottavation) string)
80 (ly:set-middle-C! context))))
83 (define (make-time-signature-set music)
84 "Set context properties for a time signature."
85 (let* ((num (ly:music-property music 'numerator))
86 (den (ly:music-property music 'denominator))
87 (structure (ly:music-property music 'beat-structure))
88 (fraction (cons num den)))
89 (list (descend-to-context
93 (let* ((time-signature-settings
94 (ly:context-property context 'timeSignatureSettings))
96 (base-length fraction time-signature-settings))
99 (beat-structure my-base-length
101 time-signature-settings)
104 (beam-exceptions fraction time-signature-settings))
105 (new-measure-length (ly:make-moment num den)))
106 (ly:context-set-property!
107 context 'timeSignatureFraction fraction)
108 (ly:context-set-property!
109 context 'baseMoment (ly:make-moment my-base-length))
110 (ly:context-set-property!
111 context 'beatStructure my-beat-structure)
112 (ly:context-set-property!
113 context 'beamExceptions beaming-exception)
114 (ly:context-set-property!
115 context 'measureLength new-measure-length))))