1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 1998--2010 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-ottava-set music)
38 "Set context properties for an ottava bracket."
39 (let ((octavation (ly:music-property music 'ottava-number)))
41 (list (context-spec-music
44 (let ((offset (* -7 octavation))
45 (string (assoc-get octavation '((2 . "15ma")
50 (set! (ly:context-property context 'middleCOffset) offset)
51 (set! (ly:context-property context 'ottavation) string)
52 (ly:set-middle-C! context))))
55 (define (make-time-signature-set music)
56 "Set context properties for a time signature."
57 (let* ((num (ly:music-property music 'numerator))
58 (den (ly:music-property music 'denominator))
59 (structure (ly:music-property music 'beat-structure))
60 (fraction (cons num den)))
61 (list (descend-to-context
65 (let* ((time-signature-settings
66 (ly:context-property context 'timeSignatureSettings))
68 (base-fraction fraction time-signature-settings))
71 (beat-structure my-base-fraction
73 time-signature-settings)
76 (beam-exceptions fraction time-signature-settings))
77 (new-measure-length (ly:make-moment num den)))
78 (ly:context-set-property!
79 context 'timeSignatureFraction fraction)
80 (ly:context-set-property!
81 context 'baseMoment (fraction->moment my-base-fraction))
82 (ly:context-set-property!
83 context 'beatStructure my-beat-structure)
84 (ly:context-set-property!
85 context 'beamExceptions beaming-exception)
86 (ly:context-set-property!
87 context 'measureLength new-measure-length))))