lilypond-user
[Top][All Lists]
Advanced

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

Re: question about overrides within repeats


From: David Nalesnik
Subject: Re: question about overrides within repeats
Date: Sun, 22 Nov 2015 13:49:09 -0600



On Sun, Nov 22, 2015 at 1:21 PM, David Kastrup <address@hidden> wrote:

> Is there any way to get the override to be reevaluated with each repeat?

No.  Written in that manner, the override is evaluated at _input_ time.
If you put it in a variable and use that variable 3 times, the colors
will be the same each time.  What you want is

#(define test
   (let ((colors (circular-list red green blue yellow darkgreen magenta)))
     (lambda (grob)
       (let ((color (car colors)))
         (set! colors (cdr colors))
         color))))

and

  \override NoteHead.color = #test

That way you'll get one call per actual _grob_ since then each grob is
then initialized with the callback, and the callback is replaced by the
value when the property is first used.


OK, I get it.  I need to override NoteHead.color with a procedure, rather than the evaluation of the procedure.  (And a grob callback must of course have a grob argument.  Passing my original as a procedure results in an error.)

Thanks so much!

David 


reply via email to

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