class New_lyric_combine_music_iterator : public Music_iterator
{
public:
- VIRTUAL_COPY_CONS (Music_iterator);
New_lyric_combine_music_iterator ();
New_lyric_combine_music_iterator (New_lyric_combine_music_iterator const&src);
DECLARE_SCHEME_CALLBACK(constructor, ());
virtual void derived_substitute (Translator_group*,Translator_group*);
private:
bool start_new_syllable () ;
- void find_thread ();
-
+ void find_voice ();
+
+ bool made_association_;
Translator_group * lyrics_context_;
Translator_group* music_context_;
Music_iterator * lyric_iter_;
New_lyric_combine_music_iterator::New_lyric_combine_music_iterator ()
{
+ made_association_ = false;
lyric_iter_ =0;
music_context_ =0;
lyrics_context_ = 0;
+
+ /*
+ Ugh. out of place here.
+ */
if (!busy_ev)
{
busy_ev
Music *m = unsmob_music (get_music ()->get_mus_property ("element"));
lyric_iter_ = unsmob_iterator (get_iterator (m));
- find_thread ();
+ find_voice ();
if (lyric_iter_)
lyrics_context_ = find_context_below (lyric_iter_->get_outlet (),
- "LyricsVoice", "");
+ "Lyrics", "");
/*
- We do not create a LyricsVoice context, because the user might
+ 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.
*/
}
void
-New_lyric_combine_music_iterator::find_thread ()
+New_lyric_combine_music_iterator::find_voice ()
{
if (!music_context_)
{
String name = ly_scm2string (voice_name);
Translator_group *voice = find_context_below (t, "Voice", name);
- Translator_group *thread = 0;
- if (voice)
- thread = find_context_below (voice, "Thread", "");
- else
- get_music ()->origin ()->warning (_f ("Cannot find Voice: %s\n",
+ if (!voice)
+ get_music ()->origin ()->warning (_f ("cannot find Voice: %s\n",
name.to_str0 ()));
-
- if (thread)
- music_context_ = thread;
+ else
+ music_context_ = voice;
- if (lyrics_context_ && voice)
- lyrics_context_->set_property ("associatedVoiceContext",
- voice->self_scm ());
+ }
+ }
+
+ if (lyrics_context_ && music_context_)
+ {
+ if (!made_association_)
+ {
+ made_association_ = true;
+ lyrics_context_->set_property ("associatedVoiceContext",
+ music_context_->self_scm ());
}
}
}
void
New_lyric_combine_music_iterator::process (Moment )
{
- find_thread ();
+ find_voice ();
if (!music_context_)
return ;
if (!music_context_->daddy_trans_)
{
- music_context_ = 0;
+ /*
+ The melody has died.
+ We die too.
+ */
if (lyrics_context_)
lyrics_context_->unset_property (ly_symbol2scm ("associatedVoiceContext"));
+ lyric_iter_ = 0;
+ music_context_ = 0;
}
if (music_context_
lyric_iter_->quit();
}
-New_lyric_combine_music_iterator::New_lyric_combine_music_iterator (New_lyric_combine_music_iterator const & src)
- : Music_iterator (src)
-{
- lyric_iter_ = 0;
-
- if (src.lyric_iter_)
- lyric_iter_ = src.lyric_iter_->clone ();
-
- if (lyric_iter_)
- scm_gc_unprotect_object (lyric_iter_->self_scm());
-
- music_context_ = src.music_context_;
- lyric_iter_ = src.lyric_iter_;
-
-
- assert (false); // shouldn't copy, really.
-}
Music_iterator*