-
- /*
- This is slightly ugh: we are now confunding the frontend
- (iterators) and the backend (note heads) */
- if (end > now
- && Note_head::has_interface (unsmob_grob (grob)))
- return true;
+ Global_context *g = voice->get_global_context ();
+ g->events_below ()->remove_listener (GET_LISTENER (check_new_context), ly_symbol2scm ("CreateContext"));
+ }
+}
+
+/*
+ Look for a suitable voice to align lyrics to.
+
+ Returns 0 if nothing should change; i.e., if we already listen to the
+ right voice, or if we don't yet listen to a voice but no appropriate
+ voice could be found.
+*/
+Context *
+Lyric_combine_music_iterator::find_voice ()
+{
+ SCM voice_name = lyricsto_voice_name_;
+ SCM running = lyrics_context_
+ ? lyrics_context_->get_property ("associatedVoice")
+ : SCM_EOL;
+
+ if (scm_is_string (running))
+ voice_name = running;
+
+ if (scm_is_string (voice_name)
+ && (!music_context_ || ly_scm2string (voice_name) != music_context_->id_string ()))
+ {
+ Context *t = get_outlet ();
+ while (t && t->get_parent_context ())
+ t = t->get_parent_context ();
+
+ string name = ly_scm2string (voice_name);
+ return find_context_below (t, ly_symbol2scm ("Voice"), name);