-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-public (music-map function music)
(function music)
))
+(define-public (music-filter pred? music)
+ "Filter out music expressions that do not satisfy PRED."
+
+ (define (inner-music-filter pred? music)
+ "Recursive function."
+ (let* ((es (ly:get-mus-property music 'elements))
+ (e (ly:get-mus-property music 'element))
+ (as (ly:get-mus-property music 'articulations))
+ (filtered-as (filter ly:music? (map (lambda (y) (inner-music-filter pred? y)) as)))
+ (filtered-e (if (ly:music? e)
+ (inner-music-filter pred? e)
+ e))
+ (filtered-es (filter ly:music? (map (lambda (y) (inner-music-filter pred? y)) es)))
+ )
+
+ (ly:set-mus-property! music 'element filtered-e)
+ (ly:set-mus-property! music 'elements filtered-es)
+ (ly:set-mus-property! music 'articulations filtered-as)
+
+ ;; if filtering emptied the expression, we remove it completely.
+ (if (or (pred? music)
+ (and (eq? filtered-es '()) (not (ly:music? e))
+ (or (not (eq? es '()))
+ (ly:music? e))))
+ (set! music '()))
+
+ music))
+
+ (set! music (inner-music-filter pred? music))
+ (if (ly:music? music)
+ music
+ (make-music-by-name 'Music) ;must return music.
+ ))
+
+(define-public (remove-tag tag)
+ (lambda (mus)
+ (music-filter
+ (lambda (m)
+ (let* ((tags (ly:get-mus-property m 'tags))
+ (res (memq tag tags)))
+ res)) mus)))
+
(define-public (display-music music)
"Display music, not done with music-map for clarity of presentation."
(display music)
((where (ly:context-property-where-defined context 'centralCPosition))
(oc0 (ly:get-context-property context 'originalCentralCPosition)))
- (ly:set-context-property context 'centralCPosition oc0)
+ (ly:set-context-property! context 'centralCPosition oc0)
(ly:unset-context-property where 'originalCentralCPosition)
(ly:unset-context-property where 'ottavation))
(-1 . "8va bassa")
(-2 . "15ma bassa"))))))
- (ly:set-context-property context 'centralCPosition new-c0)
- (ly:set-context-property context 'originalCentralCPosition c0)
- (ly:set-context-property context 'ottavation string)
+ (ly:set-context-property! context 'centralCPosition new-c0)
+ (ly:set-context-property! context 'originalCentralCPosition c0)
+ (ly:set-context-property! context 'ottavation string)
))))
(ly:set-mus-property! m 'procedure ottava-modify)
- (context-spec-music m "Staff")
+ (context-spec-music m 'Staff)
))
(define-public (set-octavation ottavation)
(basic (list set1 set2 set3 set4)))
(context-spec-music
- (make-sequential-music basic) "Timing")))
+ (make-sequential-music basic) 'Timing)))
(define-public (set-time-signature num den . rest)
(ly:export (apply make-time-signature-set `(,num ,den . ,rest))))
(make-voice-props-set number)
(make-simultaneous-music (car lst))))
- "Voice" (number->string number))
+ 'Voice (number->string number))
(voicify-list (cdr lst) (+ number 1))
))
)
(define (voicify-chord ch)
"Split the parts of a chord into different Voices using separator"
(let* ((es (ly:get-mus-property ch 'elements)))
-
-
+
(ly:set-mus-property! ch 'elements
(voicify-list (split-list es music-separator?) 0))
ch
;;(eq? #t (ly:get-grob-property elt symbol))
(not (eq? #f (memq symbol (ly:get-grob-property elt 'interfaces))))))
+(define-public ((outputproperty-compatibility func sym val) grob g-context ao-context)
+ (if (func grob)
+ (ly:set-grob-property! grob sym val)))
;;
(define-public (smart-bar-check n)
)
(ly:set-context-property! where 'graceSettings new-settings)))
- (ly:export (context-spec-music (make-apply-context set-prop) "Voice")))
+ (ly:export (context-spec-music (make-apply-context set-prop) 'Voice)))
(define-public (set-start-grace-properties context)