lilypond-user
[Top][All Lists]
Advanced

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

Variable assignment in music functions


From: Michael Ellis
Subject: Variable assignment in music functions
Date: Thu, 3 Nov 2011 11:45:13 -0400

What's the right way to define a function that assigns string values
to LilyPond variables? I'm trying to create a function in an include
file that allows me to assign different values to variables used as
midi instrument specifiers.
%--------------------------------------------------------
setMainCueClapInstruments=
#(define-music-function (p l main cue clap) (string? string? string?)
   #{
       mainInstrument = #$main
       cueInstrument  = #$cue
       clapInstrument = #$clap
   #}
   (make-music 'SequentialMusic 'void #t))
\setMainCueClapInstruments #"cello" #"acoustic grand" #"woodblock"
%--------------------------------------------------------
But the parser throws errors, starting with the following ...
Parsing...
<string>:2:7: error: syntax error, unexpected STRING

       mainInstrument = #lilyvartmpbg

I'm using LilyPond 2.14.1

Thanks,
Mike



reply via email to

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