quotation begins. It is followed by two arguments: the name of the
quoted voice, as defined with @code{\addQuote}, and a music expression
that indicates the duration of the quote, usually spacer rests or
-multi-measure rests. The corresponding music from the quoted voice is
-inserted into the music expression:
+multi-measure rests. The corresponding music (including all articulations,
+dynamics, markup, etc.) from the quoted voice is inserted into the music
+expression:
@lilypond[verbatim,quote]
flute = \relative c'' {
- a4 gis g gis
+ a4 gis g->\f gis^\markup{quoted}
}
\addQuote "flute" { \flute }
process them in different ways. For details about this procedure,
see @ref{Using tags}.
+It is also possible to adjust which objects from the original voice are quoted
+by changing the @code{quotedEventTypes} property. By default, its value is
+@code{#'(StreamEvent)}, which means that everything is quoted. Setting it
+to e.g. @code{#'(note-event rest-event tie-event)} causes lilypond to quote
+only notes, rests and ties, but no articulations, markup or dynamics.
+
+@lilypond[verbatim,quote]
+clarinet = \relative c'' {
+ a4 gis g->\f gis^\markup{quoted}
+}
+\addQuote "clarinet" { \clarinet }
+
+\relative c' {
+ \set Score.quotedEventTypes = #'(note-event rest-event tie-event)
+ c4 cis \quoteDuring #"clarinet" { s2 }
+}
+@end lilypond
@snippets
@cindex rest-event
@funindex quotedEventTypes
+@funindex quotedCueEventTypes
@lilypondfile[verbatim,lilyquote,texidoc,doctitle]
{quoting-another-voice.ly}
\cueDuring #@var{partname} #@var{voice} @var{music}
@end example
-This command copies the corresponding measures from @var{partname}
-into a @code{CueVoice} context. The @code{CueVoice} is created
-implicitly, and occurs simultaneously with @var{music}, which
+This command copies only the notes and rests from the corresponding measures
+from @var{partname} into a @code{CueVoice} context. The @code{CueVoice} is
+created implicitly, and occurs simultaneously with @var{music}, which
creates a polyphonic situation. The @var{voice} argument
determines whether the cue notes should be notated as a first or
second voice; @code{UP} corresponds to the first voice, and
@lilypond[verbatim,quote]
oboe = \relative c'' {
- r2 r8 d16 f e g f a
+ r2 r8 d16(\f f e g f a)
g8 g16 g g2.
}
\addQuote "oboe" { \oboe }
explicitly declared, or else the entire music expression would
belong to the @code{CueVoice} context.
+It is possible to adjust which aspects of the music are quoted with
+@code{\cueDuring} by setting the @code{quotedCueEventTypes} property. Its
+default value is @code{#'(note-event rest-event tie-event beam-event
+tuplet-span-event)}, which means that only notes, rest, ties, beams and
+tuplets are quoted, but not articulations, dynamic marks, markup etc.
+
+@lilypond[verbatim,quote]
+oboe = \relative c'' {
+ r2 r8 d16(\f f e g f a)
+ g8 g16 g g2.
+}
+\addQuote "oboe" { \oboe }
+
+\new Voice \relative c'' {
+ \set Score.quotedCueEventTypes = #'(note-event rest-event tie-event
+ beam-event tuplet-span-event
+ dynamic-event slur-event)
+ \cueDuring #"oboe" #UP { R1 }
+ g2 c,
+}
+@end lilypond
+
+
+
The name of the cued instrument can be printed by setting the
@code{instrumentCueName} property in the @code{CueVoice} context.
--- /dev/null
+\header {
+
+
+texidoc = " The @code{cueDuring} and @code{quoteDuring} forms of quotation
+will use the variables @code{quotedCueEventTypes} and @code{quotedEventTypes}
+to determine which events are quoted. This allows different events to be
+quoted for cue notes than for normal quotes.
+
+@code{quotedEventTypes} is also the fallback for cue notes if
+@code{quotedCueEventTypes} is not set."
+
+}
+
+\version "2.13.10"
+
+quoteMe = \relative c' { fis8 r16-. a8.-> \acciaccatura c8 b4(-\ff~ b16 c8. b8) }
+\addQuote quoteMe \quoteMe
+
+<<
+ \new Staff \with { instrumentName = "Quoted Voice" } {
+ \quoteMe
+ }
+ \new Staff \with { instrumentName = "quoteDuring" } {
+% \set Staff.quotedEventTypes = #'(StreamEvent)
+ \relative c' { c8 \quoteDuring "quoteMe" { s8 s4 s2 } }
+ }
+ \new Staff \with { instrumentName = "cueDuring" } {
+ \relative c' { c8 \cueDuring "quoteMe" #UP { r8 r4 r2 } }
+ }
+>>
+
+<<
+ \new Staff \with { instrumentName = "Fallback" } {
+ \unset Score.quotedCueEventTypes
+ \relative c' { c8 \cueDuring "quoteMe" #UP { r8 r4 r2 } }
+ }
+>>
DECLARE_SCHEME_CALLBACK (constructor, ());
bool quote_ok () const;
- bool accept_music_type (Stream_event *) const;
+ bool accept_music_type (Stream_event *, bool is_cue = true) const;
protected:
virtual void derived_mark () const;
}
bool
-Quote_iterator::accept_music_type (Stream_event *ev) const
+Quote_iterator::accept_music_type (Stream_event *ev, bool is_cue) const
{
- for (SCM accept = get_outlet ()->get_property ("quotedEventTypes");
- scm_is_pair (accept); accept = scm_cdr (accept))
+ SCM accept = SCM_EOL;
+ // Cue notes use the quotedCueEventTypes property, otherwise (and as fallback
+ // for cue notes if quotedCueEventTypes is not set) use quotedEventTypes
+ if (is_cue)
+ accept = get_outlet ()->get_property ("quotedCueEventTypes");
+ if (accept == SCM_EOL)
+ accept = get_outlet ()->get_property ("quotedEventTypes");
+
+ for (; scm_is_pair (accept); accept = scm_cdr (accept))
{
if (ev->internal_in_event_class (scm_car (accept)))
return true;
Pitch *me_pitch = unsmob_pitch (get_music ()->get_property ("quoted-transposition"));
if (!me_pitch)
me_pitch = unsmob_pitch (get_outlet ()->get_property ("instrumentTransposition"));
+ SCM cid = get_music ()->get_property ("quoted-context-id");
+ bool is_cue = scm_is_string (cid) && (ly_scm2string (cid) == "cue");
for (SCM s = scm_cdr (entry); scm_is_pair (s); s = scm_cdr (s))
{
Stream_event *ev = unsmob_stream_event (scm_car (ev_acc));
if (!ev)
programming_error ("no music found in quote");
- else if (accept_music_type (ev))
+ else if (accept_music_type (ev, is_cue))
{
/* create a transposed copy if necessary */
if (quote_pitch || me_pitch)