From d6e8918c5f9450aa34c20f03dfe520216724f615 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 17 May 2006 15:21:49 +0000 Subject: [PATCH] * lily/lexer.ll (init_signature_has_table): Add `scm-scm-music-music'. * lily/parser.yy (MUSIC_FUNCTION_SCM_SCM_MUSIC_MUSIC): New token. (Generic_prefix_music_scm): Add rule for it. * lily/quote-iterator.cc (Quote_iterator::process): Handle `quoted-transposition' property. * ly/music-functions-init.ly (transposedCueDuring): New function. * scm/define-music-properties.scm (all-music-properties): Updated. * Documenation/topdocs/NEWS.itely: Document it. --- ChangeLog | 17 +++++++++++++++++ Documentation/topdocs/NEWS.tely | 11 ++++++++++- lily/lexer.ll | 1 + lily/parser.yy | 6 ++++++ lily/quote-iterator.cc | 4 +++- ly/music-functions-init.ly | 22 +++++++++++++++++++++- scm/define-music-properties.scm | 1 + 7 files changed, 59 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 299c91d972..badcb47513 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-05-17 Werner Lemberg + + * lily/lexer.ll (init_signature_has_table): Add + `scm-scm-music-music'. + + * lily/parser.yy (MUSIC_FUNCTION_SCM_SCM_MUSIC_MUSIC): New token. + (Generic_prefix_music_scm): Add rule for it. + + * lily/quote-iterator.cc (Quote_iterator::process): Handle + `quoted-transposition' property. + + * ly/music-functions-init.ly (transposedCueDuring): New function. + + * scm/define-music-properties.scm (all-music-properties): Updated. + + * Documenation/topdocs/NEWS.itely: Document it. + 2006-05-17 Han-Wen Nienhuys * VERSION (PATCH_LEVEL): release 2.9.5 diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely index d6a3c9275b..a53cff5e09 100644 --- a/Documentation/topdocs/NEWS.tely +++ b/Documentation/topdocs/NEWS.tely @@ -67,6 +67,16 @@ which scares away people. @end ignore +@item +A new command @code{\transposedCueDuring} has been added which overrides +the cue's transposition locally. Its intended use is to octavate cues +up or down to avoid an excessive number of ledger lines. The syntax form +is + +@example +\transposedCueDuring #NAME #UPDOWN PITCH MUSIC +@end example + @item By setting @code{hairpinToBarline}, hairpins will stop at the barline preceding the ending note. @@ -77,7 +87,6 @@ the barline preceding the ending note. c4\< c2. c4\! @end lilypond - This feature was sponsored by Andrew Sidwell and Trevor Bača. @item diff --git a/lily/lexer.ll b/lily/lexer.ll index f9601985f4..d69dbb5ffd 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -895,6 +895,7 @@ static void init_signature_hash_table () {"scm-scm", MUSIC_FUNCTION_SCM_SCM}, {"music-music", MUSIC_FUNCTION_MUSIC_MUSIC}, {"scm-music-music", MUSIC_FUNCTION_SCM_MUSIC_MUSIC}, + {"scm-scm-music-music", MUSIC_FUNCTION_SCM_SCM_MUSIC_MUSIC}, {"scm-scm-music", MUSIC_FUNCTION_SCM_SCM_MUSIC}, {"scm-scm-scm-music", MUSIC_FUNCTION_SCM_SCM_SCM_SCM_MUSIC}, {"scm-scm-scm-scm-music", MUSIC_FUNCTION_SCM_SCM_SCM_MUSIC}, diff --git a/lily/parser.yy b/lily/parser.yy index 9266860f37..d7972de0b5 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -282,6 +282,7 @@ If we give names, Bison complains. %token MUSIC_FUNCTION_SCM %token MUSIC_FUNCTION_SCM_MUSIC %token MUSIC_FUNCTION_SCM_MUSIC_MUSIC +%token MUSIC_FUNCTION_SCM_SCM_MUSIC_MUSIC %token MUSIC_FUNCTION_SCM_SCM %token MUSIC_FUNCTION_SCM_SCM_MUSIC %token MUSIC_FUNCTION_SCM_SCM_SCM @@ -994,6 +995,11 @@ Generic_prefix_music_scm: $4->unprotect (); $3->unprotect (); } + | MUSIC_FUNCTION_SCM_SCM_MUSIC_MUSIC function_scm_argument function_scm_argument Music Music { + $$ = scm_list_n ($1, make_input (@$), $2, $3, $4->self_scm (), $5->self_scm (), SCM_UNDEFINED); + $4->unprotect (); + $5->unprotect (); + } | MUSIC_FUNCTION_MARKUP_MUSIC_MUSIC full_markup Music Music { $$ = scm_list_5 ($1, make_input (@$), $2, $3->self_scm (), $4->self_scm ()); $3->unprotect (); diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index f0a2d46e6b..820d0ed158 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -222,7 +222,9 @@ Quote_iterator::process (Moment m) /* The pitch that sounds like central C */ - Pitch *me_pitch = unsmob_pitch (get_outlet ()->get_property ("instrumentTransposition")); + Pitch *me_pitch = unsmob_pitch (get_music ()->get_property ("quoted-transposition")); + if (!me_pitch) + me_pitch = unsmob_pitch (get_outlet ()->get_property ("instrumentTransposition")); for (SCM s = scm_cdr (entry); scm_is_pair (s); s = scm_cdr (s)) { diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 16ac73ef72..030426ea1e 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -207,6 +207,27 @@ cueDuring = 'origin location)) +transposedCueDuring = # +(define-music-function + (parser location what dir pitch-note main-music) + (string? ly:dir? ly:music? ly:music?) + + "Insert notes from the part @var{what} into a voice called @code{cue}, +using the transposition defined by @var{pitch-note}. This happens +simultaneously with @var{main-music}, which is usually a rest. The +argument @var{dir} determines whether the cue notes should be notated +as a first or second voice." + + (make-music 'QuoteMusic + 'element main-music + 'quoted-context-type 'Voice + 'quoted-context-id "cue" + 'quoted-music-name what + 'quoted-voice-direction dir + 'quoted-transposition (pitch-of-note pitch-note) + 'origin location)) + + quoteDuring = # (define-music-function (parser location what main-music) @@ -217,7 +238,6 @@ quoteDuring = # 'origin location)) - pitchedTrill = #(define-music-function (parser location main-note secondary-note) diff --git a/scm/define-music-properties.scm b/scm/define-music-properties.scm index bb0e4e4dfe..b330534d75 100644 --- a/scm/define-music-properties.scm +++ b/scm/define-music-properties.scm @@ -80,6 +80,7 @@ It must take a single argument, being the context.") (quoted-voice-direction ,ly:dir? "Should the quoted voice be up-stem or down-stem?") (quoted-context-type ,symbol? "The name of the context to direct quotes to, eg., @code{Voice}.") (quoted-context-id ,string? "The id of the context to direct quotes to, eg., @code{cue}.") + (quoted-transposition ,ly:pitch? "The pitch used for the quote, overriding \\transposition") (to-relative-callback ,procedure? "How to transform a piece of music to relative pitches") (tweaks ,list? "An alist of properties to override in the backend for the grob made of this event.") -- 2.39.5