- if (req_l_ && ! done_)
- {
- Moment now = now_mom ();
- Link_array<Audio_note> nharr;
-
- stopped_notes_.clear ();
- while (past_notes_pq_.size ()
- && past_notes_pq_.front ().end_ == now)
- stopped_notes_.push (past_notes_pq_.get ());
- done_ = true;
- return;
- }
-
- if (req_l_)
- {
- now_notes_.sort (CNote_melodic_tuple::pitch_compare);
- stopped_notes_.sort (CNote_melodic_tuple::pitch_compare);
- int i=0;
- int j=0;
- int tie_count=0;
- while (i < now_notes_.size () && j < stopped_notes_.size ())
- {
- int comp
- = Pitch::compare (*unsmob_pitch (now_notes_[i].req_l_->get_mus_property ("pitch")),
- *unsmob_pitch (stopped_notes_[j].req_l_->get_mus_property ("pitch")));
-
- if (comp)
- {
- (comp < 0) ? i ++ : j++;
- continue;
- }
- else
- {
- tie_count ++;
-
- /* don't go around recreating ties that were already
- made. Not infallible. Due to reordering in sort (),
- we will make the wrong ties when notenotes are
- added. */
- if (tie_count > tie_p_arr_.size ())
- {
- Audio_tie * p = new Audio_tie;
- p->set_note (LEFT, stopped_notes_[j].note_l_);
- p->set_note (RIGHT, now_notes_[i].note_l_);
- tie_p_arr_.push (p);
- announce_element (Audio_element_info (p, req_l_));
- }
- i++;
- j++;
-
- }
- }
-
- if (!tie_p_arr_.size ())
- {
- req_l_->origin ()->warning (_ ("No ties were created!"));
- }
- }