[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Conditional ambitus
From: |
Thomas Morley |
Subject: |
Re: Conditional ambitus |
Date: |
Sat, 26 Jan 2013 19:10:50 +0100 |
2013/1/26 David Kastrup <address@hidden>:
> Kevin Stolt <address@hidden> writes:
>
>> Hi,
>> I'm trying to conditionally add ambitus based on a variable
>> definition. I'm
>> having trouble figure out how to do it.
>>
>> \version "2.16.2"
>> isAmbitus = #f
>> includeAmbitus = #(define-music-function
>> (parser location)
>> ()
>> (if isAmbitus
>> #{ \with { \consists "Ambitus_engraver" } #}
>> #{ #} ))
>>
>> %When I try to use includeAmbitus:
>> \score {
>> \new Voice = "one" \includeAmbitus {e' f' g'}
>> }
>>
>>
>>
>> It gives an error about an unexpected EVENT_IDENTIFIER
>> Is this there a different function type I should be using
>> instead of define-music-function?
>
> define-scheme-function. The second case will need to contain
> #{ \with { } #}
> in order to make it a context mod as well rather than a void music
> expression.
>
> Maybe you'll need \with \includeAmbitus to have it work properly.
>
> --
> David Kastrup
>
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
Why use a function at all?
\version "2.16.2"
isAmbitus = ##f
#(define includeAmbitus
(if isAmbitus
#{ \with { \consists "Ambitus_engraver" } #}
#{ \with { } #}))
\score {
\new Voice = "one" \includeAmbitus {e' f' g'}
}
Seems to work.
-Harm