lilypond-user
[Top][All Lists]
Advanced

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

Re: Auto-panner


From: David Kastrup
Subject: Re: Auto-panner
Date: Mon, 27 Jan 2014 20:51:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Jan-Peter Voigt <address@hidden> 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



reply via email to

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