;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
-;;;; (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; (c) 1998--2007 Jan Nieuwenhuizen <janneke@gnu.org>
;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
;; (use-modules (ice-9 optargs))
(set! (ly:music-property r 'repeat-count) (max times 1))
(set! (ly:music-property r 'elements) talts)
(if (equal? name "tremolo")
- (let* ((dot? (zero? (modulo times 3)))
- (dots (if dot? 1 0))
- (mult (if dot?
- (quotient (* times 2) 3)
- times))
- (shift (- (ly:intlog2 mult))))
-
+ (let* ((dots (1- (logcount times)))
+ (mult (/ (* times (ash 1 dots)) (1- (ash 2 dots))))
+ (shift (- (ly:intlog2 (floor mult)))))
+ (if (not (integer? mult))
+ (ly:warning (_ "invalid tremolo repeat count: ~a") times))
(if (memq 'sequential-music (ly:music-property main 'types))
;; \repeat "tremolo" { c4 d4 }
(let ((children (length (ly:music-property main 'elements))))
(if (odd? n) -1 1)))
direction-polyphonic-grobs)
(list
+ (make-property-set 'graceSettings
+ ;; TODO: take this from voicedGraceSettings or similar.
+ '((Voice Stem font-size -3)
+ (Voice NoteHead font-size -3)
+ (Voice Dots font-size -3)
+ (Voice Stem length-fraction 0.8)
+ (Voice Stem no-stem-extend #t)
+ (Voice Beam thickness 0.384)
+ (Voice Beam length-fraction 0.8)
+ (Voice Accidental font-size -4)))
+
(make-grob-property-set 'NoteColumn 'horizontal-shift (quotient n 2))
(make-grob-property-set 'MultiMeasureRest 'staff-position (if (odd? n) -4 4))))))
(append
(map (lambda (x) (make-grob-property-revert x 'direction))
direction-polyphonic-grobs)
- (list (make-grob-property-revert 'NoteColumn 'horizontal-shift))
- (list (make-grob-property-revert 'MultiMeasureRest 'staff-position)))))
+ (list (make-property-unset 'graceSettings)
+ (make-grob-property-revert 'NoteColumn 'horizontal-shift)
+ (make-grob-property-revert 'MultiMeasureRest 'staff-position)))))
(define-safe-public (context-spec-music m context #:optional id)
(define-public (empty-music)
(ly:export (make-music 'Music)))
-;;;
- ; Make a function that checks score element for being of a specific type.
+;; Make a function that checks score element for being of a specific type.
(define-public (make-type-checker symbol)
(lambda (elt)
;;(display symbol)
mus))
+(define-public (music-has-type music type)
+ (memq type (ly:music-property music 'types)))
+
+(define-public (music-clone music)
+ (define (alist->args alist acc)
+ (if (null? alist)
+ acc
+ (alist->args (cdr alist)
+ (cons (caar alist) (cons (cdar alist) acc)))))
+
+ (apply
+ make-music
+ (ly:music-property music 'name)
+ (alist->args (ly:music-mutable-properties music) '())))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; warn for bare chords at start.