X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fmusic-functions.scm;h=5ca4d309afd66e9b3335713bf06720a9bc10065f;hb=2d532bb826559cdb52f1414dabefd23efdbc91a4;hp=5585eebdb734c9ff59690f5edde7491d8d2b3e26;hpb=77cc001961a4931c002128b34638f69c082b9102;p=lilypond.git diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 5585eebdb7..5ca4d309af 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -340,7 +340,18 @@ i.e. this is not an override" 'grob-property gprop)) (define direction-polyphonic-grobs - '(Stem Tie Rest Slur PhrasingSlur Script TextScript Dots DotColumn Fingering)) + '(DotColumn + Dots + Fingering + LaissezVibrerTie + PhrasingSlur + RepeatTie + Rest + Script + Slur + Stem + TextScript + Tie)) (define-safe-public (make-voice-props-set n) (make-sequential-music @@ -439,27 +450,20 @@ i.e. this is not an override" "Either reset middleCPosition to the stored original, or remember old middleCPosition, add OCTAVATION to middleCPosition, and set OTTAVATION to `8va', or whatever appropriate." - (if (number? (ly:context-property context 'middleCPosition)) - (begin - (if (number? (ly:context-property context 'originalMiddleCPosition)) - (let ((where (ly:context-property-where-defined context 'middleCPosition))) - - (ly:context-set-property! context 'middleCPosition - (ly:context-property context 'originalMiddleCPosition)) - (ly:context-unset-property where 'originalMiddleCPosition) - (ly:context-unset-property where 'ottavation))) -ot - (let* ((where (ly:context-property-where-defined context 'middleCPosition)) - (c0 (ly:context-property context 'middleCPosition)) - (new-c0 (+ c0 (* -7 octavation))) - (string (cdr (assoc octavation '((2 . "15ma") - (1 . "8va") - (0 . #f) - (-1 . "8vb") - (-2 . "15mb")))))) - (ly:context-set-property! context 'middleCPosition new-c0) - (ly:context-set-property! context 'originalMiddleCPosition c0) - (ly:context-set-property! context 'ottavation string))))) + (if (number? (ly:context-property context 'middleCOffset)) + (let ((where (ly:context-property-where-defined context 'middleCOffset))) + (ly:context-unset-property where 'middleCOffset) + (ly:context-unset-property where 'ottavation))) + + (let* ((offset (* -7 octavation)) + (string (cdr (assoc octavation '((2 . "15ma") + (1 . "8va") + (0 . #f) + (-1 . "8vb") + (-2 . "15mb")))))) + (ly:context-set-property! context 'middleCOffset offset) + (ly:context-set-property! context 'ottavation string) + (ly:set-middle-C! context))) (set! (ly:music-property m 'procedure) ottava-modify) (context-spec-music m 'Staff))) @@ -998,3 +1002,34 @@ use GrandStaff as a context. " (ly:music-property (car evs) 'pitch) #f))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-public (extract-named-music music music-name) +"Return a flat list of all music named @code{music-name} +from @code{music}." + (let ((extracted-list + (if (ly:music? music) + (if (eq? (ly:music-property music 'name) music-name) + (list music) + (let ((elt (ly:music-property music 'element)) + (elts (ly:music-property music 'elements))) + (if (ly:music? elt) + (extract-named-music elt music-name) + (if (null? elts) + '() + (map (lambda(x) + (extract-named-music x music-name )) + elts))))) + '()))) + (flatten-list extracted-list))) + +(define-public (event-chord-notes event-chord) +"Return a list of all notes from @{event-chord}." + (filter + (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) + (ly:music-property event-chord 'elements))) + +(define-public (event-chord-pitches event-chord) +"Return a list of all pitches from @{event-chord}." + (map (lambda (x) (ly:music-property x 'pitch)) + (event-chord-notes event-chord)))