- Lyric_combine_music const * m = dynamic_cast<Lyric_combine_music const*> (get_music ());
-
- music_iter_ = unsmob_iterator (get_iterator (m->get_music ()));
- lyric_iter_ = unsmob_iterator (get_iterator (m->get_lyrics ()));
+ Music *m = unsmob_music (get_music ()->get_property ("element"));
+ lyric_iter_ = unsmob_iterator (get_iterator (m));
+ if (!lyric_iter_)
+ return;
+ lyrics_context_ = find_context_below (lyric_iter_->get_outlet (),
+ ly_symbol2scm ("Lyrics"), "");
+
+ if (!lyrics_context_)
+ {
+ m->origin ()->warning ("argument of \\lyricsto should contain Lyrics context");
+ }
+
+ lyricsto_voice_name_ = get_music ()->get_property ("associated-context");
+
+ Context *voice = find_voice ();
+ if (voice)
+ set_music_context (voice);
+
+ /*
+ Wait for a Create_context event. If this isn't done, lyrics can be
+ delayed when voices are created implicitly.
+ */
+ Global_context *g = get_outlet ()->get_global_context ();
+ g->events_below ()->add_listener (GET_LISTENER (check_new_context), ly_symbol2scm ("CreateContext"));
+
+ /*
+ We do not create a Lyrics context, because the user might
+ create one with a different name, and then we will not find that
+ one.
+ */