[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
\cueDuring problem
From: |
Werner LEMBERG |
Subject: |
\cueDuring problem |
Date: |
Thu, 06 Apr 2006 10:05:22 +0200 (CEST) |
[CVS 2006-04-03]
I need a variant of \cueDuring which applies additional transposition:
\transposedCueDuring #NAME #UPDOWN PITCH MUSIC
Reason is the following situation: Quoting a piccolo within C
instrument parts is just fine -- I have a `\transposition c' in the
piccolo voice which octavates the notes. Quoting this instrument
within a saxophone (in E flat) part gives far too much ledger lines,
so I want to have it transposed an additional octave down.
It seems to me that the simplest solution is to add a `quoted-pitch'
property to QuoteMusic which is then used in Quote_iterator::process
to override the pitch specified with `instrumentTransposition' -- see
patch below. The corresponding music function would be
transposedCueDuring =
#(define-music-function
(parser location what dir pitch-note main-music)
(string? ly:dir? ly:music? ly:music?)
(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))
Unfortunately, this doesn't work, because there isn't a proper
signature for a music function with four or more user-supplied
arguments -- this is a completely undocumented limitation! It took
some time until I've found the corresponding code in lexer.ll and
parser.yy.
Instead, I'm using the following kludges:
transposedCueDuringUp =
#(define-music-function
(parser location what pitch-note main-music)
(string? ly:music? ly:music?)
(make-music 'QuoteMusic
'element main-music
'quoted-context-type 'Voice
'quoted-context-id "cue"
'quoted-music-name what
'quoted-voice-direction UP
'quoted-transposition (pitch-of-note pitch-note)
'origin location))
transposedCueDuringDown =
#(define-music-function
(parser location what pitch-note main-music)
(string? ly:music? ly:music?)
(make-music 'QuoteMusic
'element main-music
'quoted-context-type 'Voice
'quoted-context-id "cue"
'quoted-music-name what
'quoted-voice-direction DOWN
'quoted-transposition (pitch-of-note pitch-note)
'origin location))
This works for me just fine. Perhaps you might add something like
this to the repository. What's missing is probably some code for
define-music-display-methods.scm -- this is code I don't understand.
Werner
======================================================================
--- ./lily/quote-iterator.cc.old 2006-04-03 05:56:57.000000000 +0200
+++ ./lily/quote-iterator.cc 2006-04-06 08:54:35.000000000 +0200
@@ -222,7 +222,9 @@
/*
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))
{
--- ./scm/define-music-properties.scm.old 2006-02-13 07:35:57.000000000
+0100
+++ ./scm/define-music-properties.scm 2006-04-06 08:54:07.000000000 +0200
@@ -84,6 +84,7 @@
(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.")
- \cueDuring problem,
Werner LEMBERG <=