- for (vsize i = heads_to_tie_.size (); i--;)
- {
- Stream_event *right_mus = inf.event_;
-
- Audio_note *th = dynamic_cast<Audio_note *> (heads_to_tie_[i].elem_);
- Stream_event *left_mus = heads_to_tie_[i].event_;
-
- if (right_mus && left_mus
+ // Find a previous note that ties to the current note. If it exists,
+ // remove it from the heads_to_tie vector and create the tie
+ vector<Audio_element_info>::iterator it;
+ bool found = false;
+ Stream_event *right_mus = inf.event_;
+ for ( it = heads_to_tie_.begin() ; (!found) && (it < heads_to_tie_.end()); it++ )
+ {
+ Audio_element_info et = *it;
+ Audio_note *th = dynamic_cast<Audio_note *> (et.elem_);
+ Stream_event *left_mus = et.event_;
+
+ if (th && right_mus && left_mus