New in version 1.1.
Clone components and covered spanners.
The components must be thread-contiguous.
Covered spanners are those spanners that cover components.
The steps taken in this function are as follows. Withdraw components from crossing spanners. Preserve spanners that components cover. Deep copy components. Reapply crossing spanners to source components. Return copied components with covered spanners.
abjad> voice = Voice(Measure((2, 8), notetools.make_repeated_notes(2)) * 3)
abjad> pitchtools.set_ascending_named_diatonic_pitches_on_nontied_pitched_components_in_expr(voice)
abjad> beam = spannertools.BeamSpanner(voice.leaves[:4])
abjad> f(voice)
\new Voice {
{
\time 2/8
c'8 [
d'8
}
{
\time 2/8
e'8
f'8 ]
}
{
\time 2/8
g'8
a'8
}
}
abjad> result = componenttools.copy_components_and_covered_spanners(voice.leaves)
abjad> result
(Note("c'8"), Note("d'8"), Note("e'8"), Note("f'8"), Note("g'8"), Note("a'8"))
abjad> new_voice = Voice(result)
abjad> f(new_voice)
\new Voice {
c'8 [
d'8
e'8
f'8 ]
g'8
a'8
}
abjad> voice.leaves[0] is new_voice.leaves[0]
False
Clone components a total of n times.
abjad> result = componenttools.copy_components_and_covered_spanners(voice.leaves[:2], n = 3)
abjad> result
(Note("c'8"), Note("d'8"), Note("c'8"), Note("d'8"), Note("c'8"), Note("d'8"))
abjad> new_voice = Voice(result)
abjad> f(new_voice)
\new Voice {
c'8
d'8
c'8
d'8
c'8
d'8
}
Changed in version 2.0: renamed clone.covered() to componenttools.copy_components_and_covered_spanners().
Changed in version 2.0: renamed componenttools.clone_components_and_covered_spanners() to componenttools.copy_components_and_covered_spanners().