lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix 1214: cueDuring and quoteDuring should also quote voices that cr


From: reinhold . kainhofer
Subject: Re: Fix 1214: cueDuring and quoteDuring should also quote voices that create subvoices (issue4816044)
Date: Thu, 28 Jul 2011 12:46:29 +0000

Reviewers: J_lowe, Keith,

Message:
On 2011/07/26 02:17:28, Keith wrote:
I like it, although I can still get the error if I put a new voice in
the quoted
expression like this:
   quoteMe = \relative c' \new Voice {

Yeah, but then we have a general problem: Which voice do we want to
quote?



http://codereview.appspot.com/4816044/diff/3001/input/regression/quote-during-subvoice.ly#newcode12
input/regression/quote-during-subvoice.ly:12: \new Voice {
You might keep the main voice going in parallel
<< { c4 c }
    \new Voice { g4 g } >>
to ensure that the patch continues to work (as it does now) to quote
an
instrument that is itself quoting third. (I've actually wanted to to
this, for
taking cues, in a couple situations.)

Yes, good idea, too.

It is interesting, in a good way, how it works with
   << {c4 c} \\ {g g} >>
divisi parts if both parts have the same rhythm,
but I would not encourage that we try to guarantee nor advertise that.

The << \\ >> construct uses two new voices, so none of the notes will be
quoted.
Cheers,
Reinhold



Description:
Fix 1214: cueDuring and quoteDuring should also quote voices that create
subvoices

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.

Please review this at http://codereview.appspot.com/4816044/

Affected files:
  A input/regression/quote-during-subvoice.ly
  M scm/part-combiner.scm


Index: input/regression/quote-during-subvoice.ly
diff --git a/input/regression/quote-during-subvoice.ly b/input/regression/quote-during-subvoice.ly
new file mode 100644
index 0000000000000000000000000000000000000000..f8d61e34923683a2b0fffeaf654cf917360e7ce3
--- /dev/null
+++ b/input/regression/quote-during-subvoice.ly
@@ -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: scm/part-combiner.scm
diff --git a/scm/part-combiner.scm b/scm/part-combiner.scm
index 0e72ebe2a057eef1f4284e9c4d69fa3c4e20ee94..54f9ea4a57aeefe4a3389c6a779e85cc06d78c1d 100644
--- a/scm/part-combiner.scm
+++ b/scm/part-combiner.scm
@@ -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 '()))))))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]