From: Reinhold Kainhofer Date: Sat, 2 Jul 2011 11:14:34 +0000 (+0200) Subject: Fix Issue 770: Lyrics attached to a voice-derived context are off by 1 X-Git-Tag: release/2.15.5-1~12 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1c25a897e494282ce0c89c4c5df3c9647d272995;p=lilypond.git Fix Issue 770: Lyrics attached to a voice-derived context are off by 1 The Lyric_combine_music_iterator had an explicit check if the CreateContext event was really for a context of type "Voice". Unfortunately, that check fails if the lyrics are supposed to be attached to a CueVoice context (or some self-defined Voice-derived context!), because "CueVoice"!="Voice". Unfortunately, I don't know how to check whether a context "CVoice" (identified only by a the context type string; we don't have any Context* object!) is an alias for Voice. If we had the Context* object, we could use is_alias, but we only have the string "CVoice" and need to check if a context of that type is an alias for "Voice". However, I don't think that check is necessary at all. It simply prevents find_voice from being called in cases when no Voice is generated (and thus no new context to possibly attach the lyrics to). If that check is removed, find_voice will also be called for any other context created while waiting for a voice to attach the lyrics to, but it will not find an appropriate voice anyway. --- diff --git a/input/regression/lyric-combine-derived-voice.ly b/input/regression/lyric-combine-derived-voice.ly new file mode 100644 index 0000000000..a5f4316dd3 --- /dev/null +++ b/input/regression/lyric-combine-derived-voice.ly @@ -0,0 +1,18 @@ +\version "2.15.4" +\header { + texidoc = "For Voice-derived contexts like CueVoice, the lyrics should +still start with the first note." +} + +\score { + \new Staff << + \new Voice \relative c'' { + g2 + << + { \voiceOne r2 } + \new CueVoice = "cue" { \voiceTwo g4 g } + >> + } + \context Lyrics \lyricsto "cue" { A B } + >> +} diff --git a/lily/lyric-combine-music-iterator.cc b/lily/lyric-combine-music-iterator.cc index 7487e2f91b..65784f130f 100644 --- a/lily/lyric-combine-music-iterator.cc +++ b/lily/lyric-combine-music-iterator.cc @@ -225,13 +225,9 @@ Lyric_combine_music_iterator::check_new_context (SCM sev) if (!ok ()) return ; - // TODO: Check first if type=Voice and if id matches - Stream_event * ev = unsmob_stream_event (sev); - if (ev->get_property ("type") != ly_symbol2scm ("Voice")) - return ; - + // Search for a possible candidate voice to attach the lyrics to. If none + // is found, we'll try next time again. Context *voice = find_voice (); - if (voice) { set_music_context (voice);