X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fautochange.scm;h=54f5e96250ce90e376a9113856ac28f419e1a3b2;hb=cc5223ac26a5713c5901c02edf2868c26be10542;hp=b7169c8a99a31f2662584cb394a98e4cc0ad6dac;hpb=9f3572d98bb948c9689cd1f75401a029451fa001;p=lilypond.git diff --git a/scm/autochange.scm b/scm/autochange.scm index b7169c8a99..54f5e96250 100644 --- a/scm/autochange.scm +++ b/scm/autochange.scm @@ -1,9 +1,9 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; autochange - fairly related to part combining. +;; autochange.scm - fairly related to part combining. -(define-public (make-autochange-music music) +(define-public (make-autochange-music parser music) (define (generate-split-list change-moment event-list acc) (if (null? event-list) acc @@ -11,10 +11,10 @@ (evs (map car (cdar event-list))) (now (car now-tun)) (notes (filter (lambda (x) - (equal? (ly:music-property x 'name) 'NoteEvent)) + (equal? (ly:event-property x 'class) 'note-event)) evs)) (pitch (if (pair? notes) - (ly:music-property (car notes) 'pitch) + (ly:event-property (car notes) 'pitch) #f))) ;; tail recursive. (if (and pitch (not (= (ly:pitch-steps pitch) 0))) @@ -30,17 +30,17 @@ (if pitch #f now) (cdr event-list) acc))))) - (set! noticed '()) (let* ((m (make-music 'AutoChangeMusic)) - (context (ly:run-translator (make-non-relative-music music) part-combine-listener)) - (evs (last-pair noticed)) + (m1 (make-non-relative-music (context-spec-music music 'Voice "one"))) + (context-list (recording-group-emulate music + (ly:parser-lookup parser 'partCombineListener))) + (evs (car context-list)) + (rev (reverse! (cdar context-list))) (split (reverse! (generate-split-list #f - (if (pair? evs) - (reverse! (cdar evs) '()) '()) + rev '()) '()))) (set! (ly:music-property m 'element) music) (set! (ly:music-property m 'split-list) split) - (set! noticed '()) m))