- Context *tos[] = {to1, to2};
- Music_iterator *mis[] = {first_iter_, second_iter_};
- Context_handle *hs[]
- = {
- &null_,
- &one_, &two_,
- &shared_, &solo_,
- 0
- };
-
- for (int i = 0; i < 2; i++)
- {
- for (int j = 0; hs[j]; j++)
- if (hs[j]->get_outlet () != tos[i])
- mis[i]->substitute_outlet (hs[j]->get_outlet (), tos[i]);
- }
-
- for (int j = 0; hs[j]; j++)
- {
- Context *t = hs[j]->get_outlet ();
- if (t != to1 && t != to2)
- kill_mmrest (t);
- }
-}
-
-void
-Part_combine_iterator::unisono (bool silent)
-{
- Status newstate = (silent) ? UNISILENCE : UNISONO;
-
- if (newstate == state_)
- return;
- else
- {
- /*
- If we're coming from SOLO2 state, we might have kill mmrests
- in the 1st voice, so in that case, we use the second voice
- as a basis for events.
- */
- Context *c1 = (last_playing_ == SOLO2) ? null_.get_outlet () : shared_.get_outlet ();
- Context *c2 = (last_playing_ == SOLO2) ? shared_.get_outlet () : null_.get_outlet ();
- substitute_both (c1, c2);
- kill_mmrest ((last_playing_ == SOLO2)
- ? one_.get_outlet () : two_.get_outlet ());
- kill_mmrest (shared_.get_outlet ());
-
- if (playing_state_ != UNISONO
- && newstate == UNISONO)
- {
- static Music *event;
- if (!event)
- event = make_music_by_name (ly_symbol2scm ("UnisonoEvent"));
-
- (last_playing_ == SOLO2 ? second_iter_ : first_iter_)
- ->try_music_in_children (event);
- playing_state_ = UNISONO;
- }
- state_ = newstate;
- }
-}