+ Grob *th = heads_to_tie_[i].head_;
+ Stream_event *right_ev = unsmob_stream_event (h->get_property ("cause"));
+ Stream_event *left_ev = unsmob_stream_event (th->get_property ("cause"));
+
+ /*
+ maybe should check positions too.
+ */
+ if (!right_ev || !left_ev)
+ continue;
+
+ if (ly_is_equal (right_ev->get_property ("pitch"),
+ left_ev->get_property ("pitch")))
+ {
+ Grob *p = new Spanner (heads_to_tie_[i].tie_definition_,
+ context ()->get_grob_key ("Tie"));
+
+ SCM cause = heads_to_tie_[i].tie_event_
+ ? heads_to_tie_[i].tie_event_->self_scm ()
+ : heads_to_tie_[i].tie_stream_event_->self_scm ();
+
+ announce_grob (p, cause);
+ Tie::set_head (p, LEFT, th);
+ Tie::set_head (p, RIGHT, h);
+
+
+ if (is_direction (unsmob_stream_event (cause)->get_property ("direction")))
+ {
+ Direction d = to_dir (unsmob_stream_event (cause)->get_property ("direction"));
+ p->set_property ("direction", scm_from_int (d));
+ }
+
+ ties_.push_back (p);
+ heads_to_tie_.erase (heads_to_tie_.begin () + i);
+ }