]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4426: Remove bar checks at the end of \parallelMusic passages
authorDavid Kastrup <dak@gnu.org>
Sun, 31 May 2015 08:53:57 +0000 (10:53 +0200)
committerDavid Kastrup <dak@gnu.org>
Mon, 8 Jun 2015 08:39:35 +0000 (10:39 +0200)
This allows ending \parallelMusic at non-bar boundaries.

input/regression/parallelmusic-partial.ly [new file with mode: 0644]
ly/music-functions-init.ly

diff --git a/input/regression/parallelmusic-partial.ly b/input/regression/parallelmusic-partial.ly
new file mode 100644 (file)
index 0000000..1ae05af
--- /dev/null
@@ -0,0 +1,34 @@
+\version "2.19.22"
+
+\header {
+  texidoc = "
+@code{\\parallelMusic} does not complain about incomplete bars at its
+end.
+"
+}
+
+\parallelMusic vI.vII
+\fixed c'
+{
+  f2 |
+  a2 |
+  d2 r2 |
+  d2 r8 cis cis cis |
+  d4 r4 \bar "|." |
+  d4 r4 \bar "|." |
+}
+
+global =
+{
+  \key d\minor
+  \time 4/4
+  \partial 2
+}
+
+\score {
+  \new StaffGroup
+  <<
+    \new Staff { \global \vI }
+    \new Staff { \global \vII }
+  >>
+}
index 0dfb92a1c03bf3a867517ea4548b13e7fe9b614b..6e9e627eec47c2ca0efb2028c23e6343d65ce38c 100644 (file)
@@ -1030,6 +1030,9 @@ Example:
   B = { d d | e e | }
   C = { e e | f f | }
 @end verbatim
+
+The last bar checks in a sequence are not copied to the result in
+order to facilitate ending the last entry at non-bar boundaries.
 ")
    (define voice-count (length voice-ids))
    (define (bar-check? m)
@@ -1050,7 +1053,7 @@ Example:
              "Store the previously built sequence into the current voice and
 change to the following voice."
              (set-car! current-voices
-                       (cons (reverse! current-sequence)
+                       (cons current-sequence
                              (car current-voices)))
              (set! current-sequence '())
              (set! current-voices (cdr current-voices)))
@@ -1067,9 +1070,21 @@ change to the following voice."
                                (if (bar-check? m) (change-voice))))))
                      lst)
            (if (pair? current-sequence) (change-voice))
-           ;; un-circularize `voices' and reorder the voices
-           (set! voices (map reverse!
-                             (list-head voices voice-count)))
+           ;; Un-circularize voices
+           (set! voices (list-head voices voice-count))
+
+           ;; Remove trailing bar checks to facilitate ending a
+           ;; sequence on a non-bar, reverse partial sequences and sequences
+           (set! voices (map!
+                         (lambda (l)
+                           (map! reverse!
+                                 (reverse!
+                                  (if (and (pair? l) (pair? (car l))
+                                           (bar-check? (caar l)))
+                                      (cons (cdar l) (cdr l))
+                                      l))))
+                         voices))
+
            ;; check sequence length
            (apply for-each (lambda seqs
                              (define (seq-len seq)