lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I mix ly and scheme in define-music-function


From: Nicolas Sceaux
Subject: Re: How do I mix ly and scheme in define-music-function
Date: Sun, 01 Apr 2007 12:26:23 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin)

Kevin Dalley <address@hidden> writes:

> This doesn't work.  The if block appears to be skipped.
>
> setAltStaff = #(define-music-function (parser location style lowerOctave 
> upperOctave)
>             (string? number? number?)
>
>               (if #t
>                 #{
>                 \set shapeNoteStyles  = #(chromatic-value notation-style 
> "shape-note-styles")
>                 \set shapeLayout = #shapeSemitone
>                 #})
> #{
>             \set Staff.clefGlyph = #"clefs.G"
>             \set middleCPosition = #(chromatic-value $style "middleCPosition")
>             \set clefPosition = #(+ (chromatic-value $style 
> "middleCPosition") (chromatic-value $style "g-clef-from-c"))
>             \set staffLineLayout = #(chromatic-value $style "layout")
>             \override Staff.StaffSymbol #'line-count = #(length 
> (all-lines-notation $style $lowerOctave $upperOctave))
>             \override Staff.StaffSymbol #'line-positions = 
> #(all-lines-notation $style $lowerOctave $upperOctave)
>             \override Staff.StaffSymbol #'internal-ledger-lines = 
> #(all-ledgers-notation $style $lowerOctave $upperOctave)
> #}
> )

Here is the structure of your function:

setAltStaff =
#(define-music-function (parser location style lowerOctave upperOctave)
                        (string? number? number?)
  (if #t
      #{ ..foo.. #})
  #{ ..baz.. #})

The function return the last form, which is always #{ ..baz.. #}.
You should write instead:

setAltStaff =
#(define-music-function (parser location style lowerOctave upperOctave)
                        (string? number? number?)
  (if condition
      #{ ..foo.. #}
      #{ ..baz.. #}))

nicolas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]