|
From: | Jan-Peter Voigt |
Subject: | Re: function that inserts a toplevel expression |
Date: | Thu, 10 May 2012 13:35:45 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 |
Hello Urs, On 10.05.2012 12:40, Urs Liska wrote: Hi David,an _ugly_ way is to produce a string and then use #(ly:parser-include-string parser topLevelString) This snip can then be included in a music- or scheme-function to be used in lily-syntax. There are cases, where I use this construct, but I try to avoid it. you can write...OK, instead of liedScore = \score { ... } and you can write liedScore = #(define-scheme-function (parser layout ...)(...) #{ \score { ... } #}) ... thanks to Davids remarkable parser refinements. (I was not amused in the first place, rewriting/updating my scores accordingly, but IMO these changes are a major step forward for lilypond!) If you reference this, it looks all the same \liedScore /optional parms/ But from your answers to the other part of the question I now know that this isn't possible.If liedScore is a music-function (returning void), it can be placed anywhere. This function can do anything possible in scheme: It can add scores or markups to the current stream: --snip-- fun = #(define-music-function (parser location mus)(ly:music?) (add-score parser (list #{ \markup { Hello World } #})) (add-score parser #{ \score { $mus } #}) (make-music 'SequentialMusic 'void #t)) \fun \relative c' { c4 e g b } --snip--Now you can put anything in your function, to create the score. Probably I'll look for a solution through defining a variable and then including the file with the \score definition.Using lilypond is handcraft and the artist often wishes to have his own unique tool ;-) I also use my own functions: http://www.xn--schne-noten-tfb.de/?tabs=3,1 http://www.xn--schne-noten-tfb.de/lalily.tgz It is poorly to not documented, but if you are interested, I can give you more information. Cheers, Jan-Peter |
[Prev in Thread] | Current Thread | [Next in Thread] |