--- lily/a2-engraver.cc 2003/03/18 04:55:24 1.1 +++ lily/a2-engraver.cc 2003/03/19 23:07:50 @@ -160,7 +160,7 @@ other thread gets annihilated, so we don't set dir. Maybe that should be optional? */ - if ((solo != SCM_BOOL_T && solo_adue == SCM_BOOL_T) + if (!(solo == SCM_BOOL_T && solo_adue == SCM_BOOL_T) /* When not same rhythm, we set dir */ && (unirhythm != SCM_BOOL_T --- lily/part-combine-music-iterator.cc 2003/03/19 15:00:42 1.1 +++ lily/part-combine-music-iterator.cc 2003/03/20 00:16:23 @@ -20,6 +20,8 @@ second_iter_ = 0; first_until_ = 0; second_until_ = 0; + first_was_resting_ = false; + second_was_resting_ = false; state_ = 0; } @@ -55,6 +57,8 @@ first_until_ = src.first_until_; second_until_ = src.second_until_; + first_was_resting_ = src.first_was_resting_; + second_was_resting_ = src.second_was_resting_; state_ = src.state_; suffix_ = src.suffix_; @@ -200,27 +204,19 @@ Moment second_mom = second_until_; Moment diff_until = diff_mom + now; - - bool first = true; Music_iterator *first_iter = first_iter_->clone (); Music_iterator *second_iter = second_iter_->clone (); - Moment last_pending (-1); Moment pending = now; - while (now < diff_until - && (first_iter->ok () || second_iter->ok ()) - // urg, this is a hack, haven't caught this case yet - && (pending != last_pending)) - { - if (!second_iter->ok ()) - pending = first_iter->pending_moment (); - else if (!first_iter->ok ()) - pending = second_iter->pending_moment (); - else - pending = first_iter->pending_moment () pending_moment (); - last_pending = pending; + /* Assume numerous things and turn them off when they prove not to be + * true. + */ + state = SOLO1 | SOLO2 | UNIRHYTHM | UNISON | UNISILENCE; + while (now < diff_until + && (first_iter->ok () || second_iter->ok ())) + { SCM first_pitches = SCM_EOL; SCM first_durations = SCM_EOL; get_music_info (pending, first_iter, @@ -241,6 +237,8 @@ interval = gh_int2scm (unsmob_pitch (ly_car (first_pitches))->steps () - unsmob_pitch (ly_car (scm_last_pair (second_pitches)))->steps ()); } + else + interval = SCM_BOOL_F; if (first_durations != SCM_EOL) { @@ -256,24 +254,22 @@ second_mom += unsmob_duration (ly_car (second_durations))->length_mom (); } - if (first_pitches != SCM_EOL && second_pitches == SCM_EOL - && ! (second_until_ > now)) + if (first_pitches != SCM_EOL && + ((second_until_ > now && second_was_resting_) || + (second_until_ <= now && second_pitches == SCM_EOL))) { state |= UNRELATED; state &= ~UNISILENCE; - if (! (state & ~ (UNRELATED | SOLO1 | UNISILENCE))) - state |= SOLO1; } else state &= ~SOLO1; - if (first_pitches == SCM_EOL && second_pitches != SCM_EOL - && ! (first_until_ > now)) + if (second_pitches != SCM_EOL && + ((first_until_ > now && first_was_resting_) || + (first_until_ <= now && first_pitches == SCM_EOL))) { state |= UNRELATED; state &= ~UNISILENCE; - if (! (state & ~ (UNRELATED | SOLO2 | UNISILENCE))) - state |= SOLO2; } else state &= ~SOLO2; @@ -281,8 +277,6 @@ if (gh_equal_p (first_durations, second_durations)) { state &= ~UNISILENCE; - if (! (state & ~ (UNIRHYTHM | UNISON))) - state |= UNIRHYTHM; } else state &= ~ (UNIRHYTHM | UNISILENCE); @@ -291,18 +285,11 @@ && gh_equal_p (first_pitches, second_pitches)) { state &= ~UNISILENCE; - if (! (state & ~ (UNIRHYTHM | UNISON))) - state |= UNISON; } else state &= ~ (UNISON); - if (first_pitches == SCM_EOL && second_pitches == SCM_EOL) - { - if (! (state & ~ (UNIRHYTHM | UNISILENCE))) - state |= UNISILENCE; - } - else if (!state) + if (!state) state |= UNRELATED; else state &= ~ (UNISILENCE); @@ -320,20 +307,28 @@ if (! (state & ~ (SPLIT_INTERVAL | UNIRHYTHM | UNISON))) state |= SPLIT_INTERVAL; } - else - state &= ~ (SPLIT_INTERVAL); } - if (first && first_pitches != SCM_EOL) - first_until_ = first_mom; - if (first && second_pitches != SCM_EOL) - second_until_ = second_mom; - first = false; + first_was_resting_ = (first_pitches == SCM_EOL); + second_was_resting_ = (second_pitches == SCM_EOL); + first_until_ = first_mom; + second_until_ = second_mom; if (first_iter->ok ()) first_iter->skip (pending); if (second_iter->ok ()) second_iter->skip (pending); + + if (first_iter->ok ()) { + if (second_iter->ok ()) { + pending = first_iter->pending_moment () pending_moment (); + } else { + pending = first_iter->pending_moment (); + } + } else if (second_iter->ok ()) { + pending = second_iter->pending_moment (); + } + now = pending; } scm_gc_unprotect_object (first_iter->self_scm ()); --- lily/include/part-combine-music-iterator.hh 2003/03/19 22:49:27 1.1 +++ lily/include/part-combine-music-iterator.hh 2003/03/19 22:51:59 @@ -39,6 +39,8 @@ Music_iterator * second_iter_; Moment first_until_; Moment second_until_; + bool first_was_resting_; + bool second_was_resting_; int state_; String suffix_; };