- else
- {
- now_heads_.sort (CHead_melodic_tuple::pitch_compare);
- stopped_heads_.sort(CHead_melodic_tuple::pitch_compare);
- int i=0;
- int j=0;
- int tie_count=0;
- while ( i < now_heads_.size () && j < stopped_heads_.size ())
- {
- int comp
- = Musical_pitch::compare (now_heads_[i].req_l_->pitch_ ,
- stopped_heads_[j].req_l_->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 noteheads are
- added. */
- if (tie_count > tie_p_arr_.size ())
- {
- Tie * p = new Tie;
- p->set_head (LEFT, stopped_heads_[j].head_l_);
- p->set_head (RIGHT, now_heads_[i].head_l_);
- tie_p_arr_.push (p);
- announce_element (Score_element_info (p, req_l_));
- }
- i++;
- j++;
-
- }
- }