]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/part-combiner.scm
* lily/music-output-def.cc (Music_output_def): remove separate
[lilypond.git] / scm / part-combiner.scm
index f27fe34a94d4651d400e75fd9e104f0405168ddd..69180a978a5f6ca8dbcd4bb0eba79b6132d13ccd 100644 (file)
@@ -118,7 +118,8 @@ Voice-state objects
     
     (define (analyse-tie-start active ev)
       (if (equal? (ly:music-property ev 'name) 'TieEvent)
-         (acons 'tie index active)
+         (acons 'tie (split-index (vector-ref voice-state-vec index))
+                active)
          active))
     
     (define (analyse-tie-end active ev)
@@ -194,8 +195,8 @@ Voice-state objects
 
 (define-public (make-part-combine-music music-list)
   (let ((m (make-music 'PartCombineMusic))
-       (m1 (context-spec-music (car music-list) 'Voice "one"))
-       (m2 (context-spec-music (cadr music-list) 'Voice "two")))
+       (m1 (make-non-relative-music (context-spec-music (car music-list) 'Voice "one")))
+       (m2  (make-non-relative-music  (context-spec-music (cadr music-list) 'Voice "two"))))
     (set! (ly:music-property m 'elements) (list m1 m2))
     (ly:run-translator m2 part-combine-listener)
     (ly:run-translator m1 part-combine-listener)
@@ -264,8 +265,15 @@ Only set if not set previously.
                 (if (and (= (length pitches1) (length pitches2)))
                     (if (and (pair? pitches1)
                              (pair? pitches2)
-                             (< chord-threshold (ly:pitch-steps
-                                                 (ly:pitch-diff (car pitches1) (car pitches2)))))
+                             (or
+                              (< chord-threshold (ly:pitch-steps
+                                                  (ly:pitch-diff (car pitches1)
+                                                                 (car pitches2))))
+
+                              ;; voice crossings:
+                              (> 0 (ly:pitch-steps (ly:pitch-diff (car pitches1)
+                                                                  (car pitches2))))
+                              ))
                         (put 'apart)
                         ;; copy previous split state from spanner state
                         (begin
@@ -282,6 +290,8 @@ Only set if not set previously.
          (let* ((now-state (vector-ref result ri))
                 (vs1 (car (voice-states now-state)))
                 (vs2 (cdr (voice-states now-state))))
+
+           
            (cond ((not vs1) (put 'apart))
                  ((not vs2) (put 'apart))
                  (else
@@ -364,7 +374,11 @@ the mark when there are no spanners active."
              (cond ((not (equal? (configuration now-state) 'apart))
                     current-idx)
                    ((> siln 0) start-idx)
-                   ((and (null? (span-state solo-state)))
+                   ((not solo-state)
+                    (put-range type start-idx current-idx)
+                    current-idx)
+                   ((and
+                     (null? (span-state solo-state)))
                     ;;
                     ;; This includes rests. This isn't a problem: long rests
                     ;; will be shared with the silent voice, and be marked
@@ -435,7 +449,7 @@ the mark when there are no spanners active."
 ;; autochange - fairly related to part combining.
 
 (define-public (make-autochange-music music)
-  (define (generate-split-list event-list acc)
+  (define (generate-split-list change-moment event-list acc)
     (if (null? event-list)
        acc
        (let* ((now-tun (caar event-list))
@@ -449,16 +463,27 @@ the mark when there are no spanners active."
                          #f)))
          ;; tail recursive.
          (if (and pitch (not (= (ly:pitch-steps pitch) 0)))
-             (generate-split-list (cdr event-list)
-                                  (cons (cons now (sign (ly:pitch-steps pitch))) acc))
-             (generate-split-list (cdr event-list) acc)))))
+             (generate-split-list #f
+                                  (cdr event-list)
+                                  (cons (cons
+
+                                         (if change-moment
+                                             change-moment
+                                             now)
+                                         (sign (ly:pitch-steps pitch))) acc))
+             (generate-split-list
+              (if pitch #f now)
+              (cdr event-list) acc)))))
+  
   (set! noticed '())
   (let* ((m (make-music 'AutoChangeMusic))
-        (context (ly:run-translator music part-combine-listener))
+        (context (ly:run-translator (make-non-relative-music music) part-combine-listener))
         (evs (last-pair noticed))
-        (split (reverse! (generate-split-list (if (pair? evs)
-                                                  (reverse! (cdar evs) '()) '())
-                                              '())
+        (split (reverse! (generate-split-list
+                          #f
+                          (if (pair? evs)
+                              (reverse! (cdar evs) '()) '())
+                          '())
                          '())))
     (set! (ly:music-property m 'element) music)
     (set! (ly:music-property m 'split-list) split)