Jan-Peter Voigt <jp.vo...@gmx.de> writes: > On 27.01.2014 16:54, David Kastrup wrote: >>> autopan = >>> > #(define-scheme-function (parser location)() >> Why define-scheme-function when returning music? > Perhaps this function had another meaning in the first place? > I overlooked this, when injecting my ApplyContext lines. >>> > (begin >>> > (set! autopan-current-voice (+ autopan-current-voice 1.0)) >>> > (make-music >>> > 'ApplyContext >>> > 'procedure >>> > (lambda (context) >>> > (let ((ctx (ly:context-find context autopan-staff-or-voice))) >>> > (if (not (ly:context? ctx)) (set! ctx context)) >>> > ;(ly:message "context ~A" ctx) >>> > (ly:context-set-property! ctx 'midiPanPosition >>> > (+ -1.0 >>> > (* autopan-current-voice >>> > (/ 2.0 >>> > (- autopan-total-voices 1.0) >> Doesn't work. At the time the function gets called, _all_ instances of >> the function get to see the same value of autopan-current-voice. > Good point. Now all Voices turned to the right ;) >> If you want to keep tabs on your current voice, you need to use a >> score-level context property. > What about a closure?
Won't be able to distinguish being called another time from the same output (\layout, \midi, \musicxml (this one's hypothetical yet), \addQuote...) or the next one. -- David Kastrup _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user