diff --git a/functions.ly b/functions.ly index 9766bee..c66515c 100644 --- a/functions.ly +++ b/functions.ly @@ -1,11 +1,64 @@ +stripArticulations = #(define-scheme-function + (music) + (ly:music?) + + (define (strip-articulations-i o) + (define (f l) + (if (null? l) + '() + (let ((o (car l))) + (if (music-is-of-type? o 'articulation-event) + (f (cdr l)) + (cons o (f (cdr l))))) + )) + + (let ((els (ly:music-property o 'elements))) + (map strip-articulations-i els)) + + (let ((arts (ly:music-property o 'articulations))) + (cond ((not (null? arts)) + (let ((n-arts (f arts))) + (ly:music-set-property! o 'articulations n-arts))))) + + o) + + (strip-articulations-i (ly:music-deep-copy music)) + ) + +forceAccidental = #(define-scheme-function + (on_off music) + (index? ly:music?) + + (let ((yn (if (= on_off 0) #f #t))) + (define (force-accidental-i o) + (define (f o) + (cond ((music-is-of-type? o 'note-event) + (ly:music-set-property! o 'force-accidental yn))) + (force-accidental-i o) + o + ) + + (let ((els (ly:music-property o 'elements))) + (map f els)) + + (let ((arts (ly:music-property o 'articulations))) + (map f arts)) + + o + ) + + (force-accidental-i (ly:music-deep-copy music)) + ) + ) + rmtext = #(define-scheme-function (o) (ly:music?) (define (f o) (ly:music-set-property! o 'text "") - (ly:music-set-property! o 'articulation-type 'nil-) + (ly:music-set-property! o 'span-text "") (let ((t (ly:music-property o 'name))) (let ((els (ly:music-property o 'elements))) (if (null? els)