- handles_[in].get_outlet ()->event_source ()->broadcast (mmrest_event_);
-}
-
-void
-Part_combine_iterator::solo1 ()
-{
- if (state_ == SOLO1)
- return;
- else
- {
- state_ = SOLO1;
- substitute_both (CONTEXT_SOLO, CONTEXT_NULL);
-
- kill_mmrest (CONTEXT_TWO);
- kill_mmrest (CONTEXT_SHARED);
-
- if (playing_state_ != SOLO1)
- {
- if (!solo_one_event_)
- {
- solo_one_event_ = new Stream_event (ly_symbol2scm ("solo-one-event"));
- solo_one_event_->unprotect ();
- }
-
- first_iter_->get_outlet ()->event_source ()->broadcast (solo_one_event_);
- }
- playing_state_ = SOLO1;
- }
-}
-
-void
-Part_combine_iterator::substitute_both (Outlet_type to1,
- Outlet_type to2)
-{
- Outlet_type tos[] = {to1, to2};
-
- Music_iterator *mis[] = {first_iter_, second_iter_};
-
- for (int i = 0; i < 2; i++)
- {
- for (int j = 0; j < NUM_OUTLETS; j++)
- if (j != tos[i])
- mis[i]->substitute_outlet (handles_[j].get_outlet (), handles_[tos[i]].get_outlet ());
- }
-
- for (int j = 0; j < NUM_OUTLETS; j++)
- {
- if (j != to1 && j != to2)
- kill_mmrest (j);
- }
-}
-
-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.
- */
- Outlet_type c1 = (last_playing_ == SOLO2) ? CONTEXT_NULL : CONTEXT_SHARED;
- Outlet_type c2 = (last_playing_ == SOLO2) ? CONTEXT_SHARED : CONTEXT_NULL;
- substitute_both (c1, c2);
- kill_mmrest ((last_playing_ == SOLO2)
- ? CONTEXT_ONE : CONTEXT_TWO);
- kill_mmrest (CONTEXT_SHARED);
-
- if (playing_state_ != UNISONO
- && newstate == UNISONO)
- {
- if (!unisono_event_)
- {
- unisono_event_ = new Stream_event (ly_symbol2scm ("unisono-event"));
- unisono_event_->unprotect ();
- }
-
-
- Context *out = (last_playing_ == SOLO2 ? second_iter_ : first_iter_)
- ->get_outlet ();
- out->event_source ()->broadcast (unisono_event_);
- playing_state_ = UNISONO;
- }
- state_ = newstate;
- }
-}
-
-void
-Part_combine_iterator::solo2 ()
-{
- if (state_ == SOLO2)
- return;
- else
- {
- state_ = SOLO2;
-
- substitute_both (CONTEXT_NULL, CONTEXT_SOLO);
-
- if (playing_state_ != SOLO2)
- {
- if (!solo_two_event_)
- {
- solo_two_event_ = new Stream_event (ly_symbol2scm ("solo-two-event"));
- solo_two_event_->unprotect ();
- }
-
- second_iter_->get_outlet ()->event_source ()->broadcast (solo_two_event_);
- playing_state_ = SOLO2;
- }
- }
-}
-
-void
-Part_combine_iterator::apart (bool silent)
-{
- if (!silent)
- playing_state_ = APART;
-
- if (state_ == APART)
- return;
- else
- {
- state_ = APART;
- substitute_both (CONTEXT_ONE, CONTEXT_TWO);
- }