Klaus Blum <[email protected]> writes:
> Hi,
>
> I have a function that uses a music expression twice.
> My problem is:
> In relative mode, this expression can lead into a different octave. Then
> the second application of the music expression starts from that new octave.
> (See the last two invocations of "\highlight" in the example below)
>
> Is there something I can do INSIDE my function to prevent this? E.g.
> storing and re-applying the current octave? Thanks for any hint. :)
>
>
> % ----------------------------------------
> highlight =
> #(define-music-function (mus)
> (ly:music?)
> #{
> <<
> $mus
> \makeClusters $mus
> >>
> #})
>
> \new Staff {
> \highlight { c'8 d' e' f' g' a' b' c'' }
> \relative c' {
> c1 \highlight { c8 d e f g f e d }
> c1 \highlight { c8 d e f g a b c }
> c1 \highlight { f,4 e d c }
> c1
> }
> }
> % ----------------------------------------
If your mail client cannot be kept from mangling spaces into unbreakable
spaces, you might want to think about attaching program files.
Try this.
% ----------------------------------------
highlight =
#(define-music-function (mus)
(ly:music?)
(make-relative (mus) mus
#{
<<
$mus
\makeClusters $mus
>>
#}))
\new Staff {
\highlight { c'8 d' e' f' g' a' b' c'' }
\relative c' {
c1 \highlight { c8 d e f g f e d }
c1 \highlight { c8 d e f g a b c }
c1 \highlight { f,4 e d c }
c1
}
}
% ----------------------------------------
--
David Kastrup