From f87c71b902750abad8bbfb22a565f9a3ffbc5e07 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Sat, 2 Jul 2011 16:15:23 +0200 Subject: [PATCH] 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. If the music expression passed to \addQuote is a voice itself, we only use its contents for quoting. --- input/regression/quote-during-subvoice.ly | 21 +++++++++++++++++++++ scm/part-combiner.scm | 22 +++++++++++++++------- 2 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 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 0000000000..00ba9f22d1 --- /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 +} diff --git a/scm/part-combiner.scm b/scm/part-combiner.scm index 0e72ebe2a0..54f9ea4a57 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 '())))))) -- 2.39.2