lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Search of context hierarchy for voice for lyrics is made optional (issue


From: tdanielsmusic
Subject: Search of context hierarchy for voice for lyrics is made optional (issue4323045)
Date: Wed, 30 Mar 2011 14:37:00 +0000

Reviewers: ,

Message:
Here's a proposed fix for issue 1579.

I'm not sure if the extended search for a context to
provide lyric rhythms is actually required, especially as
the search sometimes returns inappropriate contexts, but
in case it is I've simply hidden it behind a new context
property which defaults to #f.  It will then be easy to
either improve the search or remove it entirely later.

Description:
Search of context hierarchy for voice for lyrics is optional

 - add new context property, searchForVoice, to indicate whether
   the extended search for a voice containing lyric rhythms should
   be conducted

 - test searchForVoice in get_voice_to_lyrics () to decide whether
   to conduct an extended search

 - fixes 1579

Please review this at http://codereview.appspot.com/4323045/

Affected files:
  M lily/lyric-engraver.cc
  M ly/engraver-init.ly
  M scm/define-context-properties.scm


Index: lily/lyric-engraver.cc
diff --git a/lily/lyric-engraver.cc b/lily/lyric-engraver.cc
index eafde88b33c6792e83bf304ddc6a0daab5c2dfc8..c52cba8356cb59f25bfb678ef3e9dc164dc8e4b0 100644
--- a/lily/lyric-engraver.cc
+++ b/lily/lyric-engraver.cc
@@ -92,6 +92,8 @@ Lyric_engraver::process_music ()
 Context *
 get_voice_to_lyrics (Context *lyrics)
 {
+ bool searchForVoice = to_boolean (lyrics->get_property ("searchForVoice"));
+
   SCM avc = lyrics->get_property ("associatedVoiceContext");
   if (Context *c = unsmob_context (avc))
     return c;
@@ -101,7 +103,7 @@ get_voice_to_lyrics (Context *lyrics)

   if (scm_is_string (voice_name))
     nm = ly_scm2string (voice_name);
-  else if (nm == "")
+  else if (nm == "" || !searchForVoice)
     return 0;
   else
     {
@@ -202,7 +204,8 @@ ADD_TRANSLATOR (Lyric_engraver,
                /* read */
                "ignoreMelismata "
                "includeGraceNotes "
-               "lyricMelismaAlignment ",
+               "lyricMelismaAlignment "
+               "searchForVoice",

                /* write */
                ""
Index: ly/engraver-init.ly
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index 8cfd9db44ca4e969cd52e40d115cac00525c1288..6fccc5d134631328abaf0e4efe3292a8a7b712ed 100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -421,9 +421,6 @@ centered between the staves surrounding this context."
 printing of a single line of lyrics."

   \name "Lyrics"
-  instrumentName = #'()
-  shortInstrumentName = #'()
-
   \consists "Lyric_engraver"
   \consists "Extender_engraver"
   \consists "Hyphen_engraver"
@@ -431,6 +428,7 @@ printing of a single line of lyrics."
   \consists "Instrument_name_engraver"
   \consists "Font_size_engraver"
   \consists "Hara_kiri_engraver"
+  searchForVoice = ##f
   %% explicitly set instrument, so it is not inherited from the parent
   instrumentName = #'()
   shortInstrumentName = #'()
Index: scm/define-context-properties.scm
diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 439f68a72e08885eaf71919dfad4cf1a311d6437..a813f1421f6b90ae8d8d9e7fba41000e8ebcb84a 100644
--- a/scm/define-context-properties.scm
+++ b/scm/define-context-properties.scm
@@ -418,7 +418,9 @@ is set.")
      (restNumberThreshold ,number? "If a multimeasure rest has more
 measures than this, a number is printed.")

-
+     (searchForVoice ,boolean? "Signal whether a search should be made
+of all contexts in the context hierarchy for a voice to provide rhythms
+for the lyrics.")
      (shapeNoteStyles ,vector? "Vector of symbols, listing style for
 each note head relative to the tonic (qv.) of the scale.")
      (shortInstrumentName ,markup? "See @code{instrumentName}.")





reply via email to

[Prev in Thread] Current Thread [Next in Thread]