]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 1214: cueDuring and quoteDuring should also quote voices that create subvoices
authorReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 2 Jul 2011 14:15:23 +0000 (16:15 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sat, 13 Aug 2011 09:14:21 +0000 (11:14 +0200)
If a voice was quoted that created a subvoice, add-quotable wrongly selected
only that subvoice for quoting rather than the original voice.

The proper fix is to correctly use the assoc list returned by
recording-group-emulate. We need to hand it a proper unique voice name
and can then extract the events for just this voice, no matter which other
voices are created.

If the music expression passed to \addQuote is a voice itself, we only use
its contents for quoting.

input/regression/quote-during-subvoice.ly [new file with mode: 0644]
scm/part-combiner.scm

diff --git a/input/regression/quote-during-subvoice.ly b/input/regression/quote-during-subvoice.ly
new file mode 100644 (file)
index 0000000..00ba9f2
--- /dev/null
@@ -0,0 +1,21 @@
+\version "2.15.6"
+
+\header {
+  texidoc = "@code{\\quoteDuring} and @code{\\cueDuring} shall properly quote
+voices that create a sub-voice. The sub-voice will not be quoted, though.
+"
+}
+
+
+quoteMe = \relative c' {
+  c4 c
+  \new Voice {
+    c4 c
+  }
+}
+\addQuote quoteMe \quoteMe
+
+\relative c'' {
+  c4 \cueDuring #"quoteMe" #DOWN { r4 } % <- show a cue note from quoteMe
+  c4 \cueDuring #"quoteMe" #DOWN { r4 } % <- no cue note due to sub-voice
+}
index 0e72ebe2a057eef1f4284e9c4d69fa3c4e20ee94..54f9ea4a57aeefe4a3389c6a779e85cc06d78c1d 100644 (file)
@@ -571,10 +571,18 @@ the mark when there are no spanners active.
 
 (define-public (add-quotable parser name mus)
   (let* ((tab (eval 'musicQuotes (current-module)))
-        (context-list (recording-group-emulate (context-spec-music mus 'Voice)
-                                               (ly:parser-lookup parser 'partCombineListener))))
-    (if (pair? context-list)
-       (hash-set! tab name
-                  ;; cdr : skip name string
-                  (list->vector (reverse! (cdar context-list)
-                                          '()))))))
+         ;; If a Voice is passed, use its contents:
+         (contents (if (equal? (ly:music-property mus 'name) 'ContextSpeccedMusic)
+                       (ly:music-property mus 'element)
+                       mus))
+         (voicename (get-next-unique-voice-name))
+         ;; recording-group-emulate returns an assoc list, so hand it a
+         ;; proper unique context name and extract that key:
+         (context-list (recording-group-emulate (context-spec-music contents 'Voice voicename)
+                                                (ly:parser-lookup parser 'partCombineListener)))
+         (quote-contents (if (assoc voicename context-list)
+                             (assoc-get voicename context-list)
+                             '())))
+
+    (if quote-contents
+        (hash-set! tab name (list->vector (reverse! quote-contents '()))))))