]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lyric-combine-music-iterator.cc
* lily/spacing-spanner.cc (calc_common_shortest_duration): use
[lilypond.git] / lily / lyric-combine-music-iterator.cc
index feb18d65590db03c0ae81108b70c7e72174b5ed7..aaccf2e2107bccd81438c580b05cc8efe612f136 100644 (file)
@@ -76,13 +76,13 @@ Lyric_combine_music_iterator::set_music_context (Context *to)
 {
   if (music_context_)
     {
-      music_context_->event_source()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("MusicEvent"));
+      music_context_->event_source()->remove_listener (GET_LISTENER (set_busy), ly_symbol2scm ("OldMusicEvent"));
       lyrics_context_->unset_property (ly_symbol2scm ("associatedVoiceContext"));
     }
   music_context_ = to;
   if (to)
     {
-      to->event_source()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("MusicEvent"));
+      to->event_source()->add_listener (GET_LISTENER (set_busy), ly_symbol2scm ("OldMusicEvent"));
       lyrics_context_->set_property ("associatedVoiceContext", to->self_scm ());
     }
 }
@@ -95,8 +95,6 @@ Lyric_combine_music_iterator::start_new_syllable ()
 
   busy_ = false;
 
-      scm_display (music_context_->now_mom().smobbed_copy(), scm_current_output_port ());
-
   if (!lyrics_context_)
     return false;
 
@@ -204,7 +202,11 @@ Lyric_combine_music_iterator::check_new_context (SCM sev)
 }
 
 /*
-Look for a suitable voice to align lyrics to.
+  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 ()
@@ -234,7 +236,11 @@ Lyric_combine_music_iterator::find_voice ()
 void
 Lyric_combine_music_iterator::process (Moment)
 {
-  find_voice ();
+  /* see if associatedVoice has been changed */
+  Context *new_voice = find_voice ();
+  if (new_voice)
+    set_music_context (new_voice);
+
   if (!music_context_)
     return;