X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpart-combine-iterator.cc;h=f84e70cc9ac00bcf903ccf42cb9797fb64e6d8ac;hb=b882256ddb159e7169a30052f0c9fb2999f83b7a;hp=2428d4a70fb41f26bfcbce5cd0e8dcb07c1a818f;hpb=c054eb280fd9953596eb164f67b0f9d5555c5a32;p=lilypond.git diff --git a/lily/part-combine-iterator.cc b/lily/part-combine-iterator.cc index 2428d4a70f..f84e70cc9a 100644 --- a/lily/part-combine-iterator.cc +++ b/lily/part-combine-iterator.cc @@ -65,15 +65,7 @@ private: Moment start_moment_; SCM split_list_; - SCM direction_; - SCM directionOne_; - SCM directionTwo_; - SCM horizontalShiftOne_; - SCM horizontalShiftTwo_; - - Stream_event *unisono_event_; - Stream_event *solo_one_event_; - Stream_event *solo_two_event_; + Stream_event *mmrest_event_; enum Status @@ -139,18 +131,10 @@ Part_combine_iterator::do_quit () Part_combine_iterator::Part_combine_iterator () { mmrest_event_ = 0; - unisono_event_ = 0; - solo_two_event_ = 0; - solo_one_event_ = 0; first_iter_ = 0; second_iter_ = 0; split_list_ = SCM_EOL; - direction_ = SCM_BOOL_F; - directionOne_ = scm_from_int (1); - directionTwo_ = scm_from_int (-1); - horizontalShiftOne_ = scm_from_int (0); - horizontalShiftTwo_ = scm_from_int (1); state_ = APART; chosen_part_ = 1; playing_state_ = PLAYING_OTHER; @@ -167,14 +151,8 @@ Part_combine_iterator::derived_mark () const scm_gc_mark (first_iter_->self_scm ()); if (second_iter_) scm_gc_mark (second_iter_->self_scm ()); - if (unisono_event_) - scm_gc_mark (unisono_event_->self_scm ()); if (mmrest_event_) scm_gc_mark (mmrest_event_->self_scm ()); - if (solo_one_event_) - scm_gc_mark (solo_one_event_->self_scm ()); - if (solo_two_event_) - scm_gc_mark (solo_two_event_->self_scm ()); } void @@ -260,17 +238,6 @@ Part_combine_iterator::unisono (bool silent, int newpart) if (playing_state_ != PLAYING_UNISONO && newstate == UNISONO) { - if (!unisono_event_) - { - unisono_event_ = new Stream_event - (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), - ly_symbol2scm ("unisono-event"))); - unisono_event_->unprotect (); - } - - Context *out = (newpart == 2 ? second_iter_ : first_iter_) - ->get_outlet (); - out->event_source ()->broadcast (unisono_event_); playing_state_ = PLAYING_UNISONO; } state_ = newstate; @@ -292,18 +259,6 @@ Part_combine_iterator::solo1 () kill_mmrest (CONTEXT_TWO); kill_mmrest (CONTEXT_SHARED); - if (playing_state_ != PLAYING_SOLO1) - { - if (!solo_one_event_) - { - solo_one_event_ = new Stream_event - (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), - ly_symbol2scm ("solo-one-event"))); - solo_one_event_->unprotect (); - } - - first_iter_->get_outlet ()->event_source ()->broadcast (solo_one_event_); - } playing_state_ = PLAYING_SOLO1; } } @@ -319,19 +274,7 @@ Part_combine_iterator::solo2 () chosen_part_ = 2; substitute_both (CONTEXT_NULL, CONTEXT_SOLO); - if (playing_state_ != PLAYING_SOLO2) - { - if (!solo_two_event_) - { - solo_two_event_ = new Stream_event - (scm_call_1 (ly_lily_module_constant ("ly:make-event-class"), - ly_symbol2scm ("solo-two-event"))); - solo_two_event_->unprotect (); - } - - second_iter_->get_outlet ()->event_source ()->broadcast (solo_two_event_); - playing_state_ = PLAYING_SOLO2; - } + playing_state_ = PLAYING_SOLO2; } } @@ -369,17 +312,6 @@ Part_combine_iterator::construct_children () { start_moment_ = get_outlet ()->now_mom (); split_list_ = get_music ()->get_property ("split-list"); - direction_ = get_music ()->get_property ("direction"); - if (is_direction (direction_)) - { - directionOne_ = direction_; - directionTwo_ = direction_; - if (scm_is_true (scm_negative_p (direction_))) - { - horizontalShiftOne_ = scm_from_int (1); - horizontalShiftTwo_ = scm_from_int (0); - } - } Context *c = get_outlet (); @@ -402,44 +334,6 @@ Part_combine_iterator::construct_children () second_iter_ = Music_iterator::unsmob (get_iterator (Music::unsmob (scm_cadr (lst)))); Context *shared = handles_[CONTEXT_SHARED].get_context (); set_context (shared); - - /* Mimic all settings of voiceOne/voiceTwo for the two separate voices...*/ - /* FIXME: Is there any way to use the definition of \voiceOne/\voiceTwo - directly??? */ - char const *syms[] - = - { - "Stem", - "DynamicLineSpanner", - "Tie", - "Dots", - "MultiMeasureRest", - "Rest", - "Slur", - "TextScript", - "Script", - 0 - }; - - for (char const **p = syms; *p; p++) - { - SCM sym = ly_symbol2scm (*p); - execute_pushpop_property (one, sym, - ly_symbol2scm ("direction"), directionOne_); - - execute_pushpop_property (two, sym, - ly_symbol2scm ("direction"), directionTwo_); - - if (scm_is_number (direction_)) - execute_pushpop_property (shared, sym, - ly_symbol2scm ("direction"), direction_); - } - /* Handle horizontal shifts for crossing notes */ - execute_pushpop_property (one, ly_symbol2scm ("NoteColumn"), - ly_symbol2scm ("horizontal-shift"), horizontalShiftOne_); - execute_pushpop_property (two, ly_symbol2scm ("NoteColumn"), - ly_symbol2scm ("horizontal-shift"), horizontalShiftTwo_); - } IMPLEMENT_LISTENER (Part_combine_iterator, set_busy); @@ -490,30 +384,30 @@ Part_combine_iterator::process (Moment m) SCM tag = scm_cdar (split_list_); - if (tag == ly_symbol2scm ("chords")) + if (scm_is_eq (tag, ly_symbol2scm ("chords"))) chords_together (); - else if (tag == ly_symbol2scm ("apart") - || tag == ly_symbol2scm ("apart-silence") - || tag == ly_symbol2scm ("apart-spanner")) - apart (tag == ly_symbol2scm ("apart-silence")); - else if (tag == ly_symbol2scm ("unisono")) + else if (scm_is_eq (tag, ly_symbol2scm ("apart")) + || scm_is_eq (tag, ly_symbol2scm ("apart-silence")) + || scm_is_eq (tag, ly_symbol2scm ("apart-spanner"))) + apart (scm_is_eq (tag, ly_symbol2scm ("apart-silence"))); + else if (scm_is_eq (tag, ly_symbol2scm ("unisono"))) { // Continue to use the most recently used part because we might have // killed mmrests in the other part. unisono (false, (last_playing_ == 2) ? 2 : 1); } - else if (tag == ly_symbol2scm ("unisilence")) + else if (scm_is_eq (tag, ly_symbol2scm ("unisilence"))) { // as for unisono unisono (true, (last_playing_ == 2) ? 2 : 1); } - else if (tag == ly_symbol2scm ("silence1")) + else if (scm_is_eq (tag, ly_symbol2scm ("silence1"))) unisono (true, 1); - else if (tag == ly_symbol2scm ("silence2")) + else if (scm_is_eq (tag, ly_symbol2scm ("silence2"))) unisono (true, 2); - else if (tag == ly_symbol2scm ("solo1")) + else if (scm_is_eq (tag, ly_symbol2scm ("solo1"))) solo1 (); - else if (tag == ly_symbol2scm ("solo2")) + else if (scm_is_eq (tag, ly_symbol2scm ("solo2"))) solo2 (); else if (scm_is_symbol (tag)) {