]> git.donarmstrong.com Git - lilypond.git/commitdiff
Allow music-wrapper-music as toplevel of \parallelMusic
authorDavid Kastrup <dak@gnu.org>
Mon, 30 Jan 2012 10:28:37 +0000 (11:28 +0100)
committerDavid Kastrup <dak@gnu.org>
Wed, 8 Feb 2012 09:58:09 +0000 (10:58 +0100)
ly/music-functions-init.ly

index a22292657fcb968b480df290ee347acea9253d18..5afd8e44acaef03cb6e0e68d160e9090868aea6b 100644 (file)
@@ -692,7 +692,9 @@ Example:
 ")
    (let* ((voices (apply circular-list (make-list (length voice-ids) (list))))
          (current-voices voices)
-         (current-sequence (list)))
+         (current-sequence (list))
+         (original music)
+         (wrapper #f))
      ;;
      ;; utilities
      (define (push-music m)
@@ -718,6 +720,16 @@ Example:
                       (let ((origins (remove not (map music-origin
                                                       (ly:music-property music 'elements)))))
                         (and (not (null? origins)) (car origins)))))))
+     (while (music-is-of-type? music 'music-wrapper-music)
+           (set! wrapper music)
+           (set! music (ly:music-property wrapper 'element)))
+     (if wrapper
+        (set! (ly:music-property wrapper 'element)
+                                 (make-music 'SequentialMusic
+                                             'origin location))
+        (set! original
+              (make-music 'SequentialMusic
+                          'origin location)))
      ;;
      ;; first, split the music and fill in voices
      ;; We flatten direct layers of SequentialMusic since they are
@@ -758,9 +770,12 @@ Example:
      ;; bind voice identifiers to the voices
      (for-each (lambda (voice-id voice)
            (ly:parser-define! parser voice-id
-                              (make-music 'SequentialMusic
-                                          'origin location
-                                          'elements voice)))
+                              (let ((v (ly:music-deep-copy original)))
+                                (set! (ly:music-property
+                                       (car (extract-named-music
+                                             v 'SequentialMusic))
+                                       'elements) voice)
+                                v)))
          voice-ids voices)))
 
 parenthesize =