added some extra strip functions
This commit is contained in:
55
functions.ly
55
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)
|
||||
|
||||
Reference in New Issue
Block a user