]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/new-lyric-combine-music-iterator.cc (find_voice): allow
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 25 Jul 2004 14:06:46 +0000 (14:06 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 25 Jul 2004 14:06:46 +0000 (14:06 +0000)
change of melody by setting associatedVoice.

* lily/parser.yy (re_rhythmed_music): \lyricsto implies lyrics mode.

ChangeLog
Documentation/topdocs/NEWS.texi
Documentation/user/notation.itely
input/test/lyrics-melisma-faster.ly [new file with mode: 0644]
input/test/lyrics-melisma-variants.ly [new file with mode: 0644]
lily/new-lyric-combine-music-iterator.cc
lily/parser.yy

index 097683aaa7b5fb4a1a59983b0bc6b083f06a7e11..e7474d525db3a6c4be81308e753e2d804af5dbb1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-07-25  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/new-lyric-combine-music-iterator.cc (find_voice): allow
+       change of melody by setting associatedVoice.
+
+       * lily/parser.yy (re_rhythmed_music): \lyricsto implies lyrics mode.
+
        * scripts/lilypond-book.py (Lilypond_file_snippet.ly): don't copy
        file contents, rather \include them, so default linewidth is set.
        (ly_options): make BOOKPAPER set of options. Move linewidth
index af1a26a5724cd8a5821a7ed5dc5d3e86032eb109..10b5f2ef70226f368fc3d35a16afc246e817cb72 100644 (file)
@@ -7,6 +7,9 @@
 @unnumbered New features in 2.3 since 2.2
 
 @itemize @bullet
+@item The melody  for a @code{\lyricsto} text can be changed during a melody.
+
+@item The @code{\lyricsto} keyword now automatically sets @code{\lyrics}.
 
 @item The LilyPond binary  now supports output options
 @code{--dvi} @code{--png} @code{--ps} @code{--pdf} and
index 7b597da7a396dc44f739b37a52174de0715d9983..69146ccac4b48d03fc8f5f814a17993abd96099c 100644 (file)
@@ -3567,7 +3567,10 @@ Program reference: Music expressions: @internalsref{LyricCombineMusic},
 Contexts: @internalsref{Lyrics}, @internalsref{Melisma_translator}.
 
 Examples: @inputfileref{input/template,satb.ly},
-@inputfileref{input/regression,lyric-combine-new.ly}.
+@inputfileref{input/regression,lyric-combine-new.ly},
+@c TODO: make separate section for melismata 
+@inputfileref{input/test,lyrics-melisma-variants.ly}.
+@inputfileref{input/test,lyrics-melisma-faster.ly}.
  
 @refbugs
 
diff --git a/input/test/lyrics-melisma-faster.ly b/input/test/lyrics-melisma-faster.ly
new file mode 100644 (file)
index 0000000..20c6c08
--- /dev/null
@@ -0,0 +1,31 @@
+\header
+{
+    texidoc = "A faster lyrics line may be set to a melismatic melody by
+setting @code{ignoreMelismata}. A tricky aspect is that ignoreMelismata
+must be set  a syllable too soon."
+    
+}
+
+
+\paper {
+    raggedright = ##t
+}
+
+\version "2.3.8"
+
+<<
+    \relative \context Voice = "lahlah" {
+       \set Staff.autoBeaming = ##f 
+       c4
+       \slurDotted
+       f8.[( g16])
+    }
+    \new Lyrics \lyricsto "lahlah" {
+       slo -- ow
+    }
+    \new Lyrics \lyricsto "lahlah" {
+       \set ignoreMelismata = ##t % applies to "fas"
+       go fas -- ter
+       \unset ignoreMelismata
+    }
+>>    
diff --git a/input/test/lyrics-melisma-variants.ly b/input/test/lyrics-melisma-variants.ly
new file mode 100644 (file)
index 0000000..3c43ee4
--- /dev/null
@@ -0,0 +1,57 @@
+\header {
+
+texidoc = "You can switch the Voice context for a lyrics melody
+    during a lyrics line using @code{associatedVoice}.  Here, the
+    syllables \"rannosau\" are set to triplets.
+
+A tricky aspect is that @code{associatedVoice} needs to be changed one
+syllable too soon.
+
+"
+}
+
+\paper {
+    raggedright = ##t
+}
+
+\version "2.3.8"
+
+<<
+    \relative \context Voice = "lahlah" {
+       \set Staff.autoBeaming = ##f 
+       c4
+       <<
+           \context Voice = alternative {
+               \voiceOne
+               \times 2/3 {
+
+                   % show associations clearly.
+                   \override NoteColumn #'force-hshift = #-3
+                   f8 f g
+               }
+           }
+           {
+               \voiceTwo
+               f8.[ g16]
+               \oneVoice
+         } >>
+       a8( b) c
+
+    }
+    \new Lyrics \lyricsto "lahlah" \lyrics {
+       Ju -- ras -- sic Park
+    }
+    \new Lyrics \lyricsto "lahlah" \lyrics {
+
+       % Tricky: need to set associatedVoice
+       % one syllable too soon! 
+       \set associatedVoice = alternative % applies to "ran"
+       Ty --
+       ran  --
+       no --
+       \set associatedVoice = lahlah % applies to "rus"
+       sau -- rus Rex
+    } >>
+    
+
+
index ff658fc8fac039adb3dd52f8bc472313e699429a..6b73ba7e68e17f5a17085d6be45ff7de653e25cc 100644 (file)
@@ -1,11 +1,11 @@
 /*   
-new-lyric-combine-iterator.cc --  implement New_lyric_combine_music_iterator
+     new-lyric-combine-iterator.cc -- implement New_lyric_combine_music_iterator
 
-source file of the GNU LilyPond music typesetter
+     source file of the GNU LilyPond music typesetter
 
-(c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+     (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
- */
+*/
 
 #include "context.hh"
 #include "lyric-combine-music.hh"
@@ -38,6 +38,8 @@ private:
   bool made_association_;
   Context * lyrics_context_;
   Context * music_context_;
+  SCM lyricsto_voice_name_;
+  
   Music_iterator * lyric_iter_;
 };
 
@@ -142,6 +144,9 @@ New_lyric_combine_music_iterator::construct_children ()
   Music *m = unsmob_music (get_music ()->get_property ("element"));
   lyric_iter_ = unsmob_iterator (get_iterator (m));
 
+  lyricsto_voice_name_ = get_music ()->get_property ("associated-context");
+
+  
   find_voice ();
   
   if (lyric_iter_)
@@ -158,22 +163,33 @@ New_lyric_combine_music_iterator::construct_children ()
 void
 New_lyric_combine_music_iterator::find_voice ()
 {
-  if (!music_context_)
+  SCM voice_name = lyricsto_voice_name_;
+  SCM running = lyrics_context_ ? lyrics_context_->get_property ("associatedVoice") : SCM_EOL;
+
+  if (ly_c_string_p (running))
+    voice_name = running;
+
+  if (ly_c_string_p (voice_name)
+      && (!music_context_ || ly_scm2string (voice_name) != music_context_->id_string ()))    
     {
-      SCM voice_name = get_music ()->get_property ("associated-context");
-  
-      if (ly_c_string_p (voice_name))
-       {
-         Context *t = get_outlet ();
-         while (t && t->get_parent_context ())
-           t = t->get_parent_context ();
-
-         String name = ly_scm2string (voice_name);
-         Context *voice = find_context_below (t, ly_symbol2scm ("Voice"), name);
-         if (voice)
-           music_context_ = voice;
-           
-       }
+      /*
+       (spaghettini).
+       
+       Need to set associatedVoiceContext again
+       */
+      if (music_context_)
+       made_association_ = false;
+      
+      Context *t = get_outlet ();
+      while (t && t->get_parent_context ())
+       t = t->get_parent_context ();
+
+      String name = ly_scm2string (voice_name);
+      Context *voice = find_context_below (t, ly_symbol2scm ("Voice"), name);
+
+      
+      if (voice)
+       music_context_ = voice;
     }
 
   if (lyrics_context_ && music_context_)
index 49d14e13993d8e6d9338b30963d6a8e6cf7fc801..cfd64db5256cc785e49550897ec03b6037f8443b 100644 (file)
@@ -1234,9 +1234,12 @@ re_rhythmed_music:
                $$ = all;
                scm_gc_unprotect_object ($1->self_scm ());
        }
-       | LYRICSTO string Music {
-               Music *music = $3;
-               SCM name = $2;
+       | LYRICSTO {
+               THIS->lexer_->push_lyric_state ();
+       } simple_string Music {
+               THIS->lexer_->pop_state ();
+               Music *music = $4;
+               SCM name = $3;
                $$ = make_lyric_combine_music (name, music);
                scm_gc_unprotect_object (music->self_scm ());
        }