lilypond-user
[Top][All Lists]
Advanced

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

Re: Thanks to David Nalesnik and Jan-Peter Voigt


From: David Nalesnik
Subject: Re: Thanks to David Nalesnik and Jan-Peter Voigt
Date: Sun, 28 Sep 2014 19:37:11 -0500

Hi Jay,

On Sun, Sep 28, 2014 at 7:24 PM, David Nalesnik <address@hidden> wrote:

Possibly the problem is that the custom engraver is setting measureLength too late for Completion_heads_engraver to use it?


That just might be it.  The Completion_heads_engraver listens for note-events.  So, doing this same with the custom engraver gives us the code below:

 alternateTiming =
#(lambda (sig)
   (lambda (context)
     (let ((last-bnum 0))
       (make-engraver
        (listeners ((note-event engraver event)
                    (let* ((bnum (ly:context-property context 'currentBarNumber))
                           (len (length sig)) ; how many terms in compound meter
                           (pos (modulo bnum len))
                           (pos (if (= 0 pos) len pos)) ; first bar in pattern, second...
                           (pos-in-list (1- pos)) ; because elements of list are numbered from 0
                           (desired-measure-len (to-moment (list-ref sig pos-in-list))))
                      (ly:context-set-property! context 'measureLength desired-measure-len)
                      (format #t "bnum = ~a len ~a pos ~a measurelength ~a completion ~a~%"
                        bnum len pos
                        (ly:context-property context 'measureLength)
                        (ly:context-property context 'completionUnit))
                      (if (= pos-in-list 0)
                          (begin
                           (if (> bnum last-bnum)
                               (ly:context-set-property! context 'whichBar "||"))
                           (set! last-bnum bnum))))))))))

%%%%%%%%%%%

This appears to work with your two-staff example.  How it fares with others, I don't know.  Keep your fingers crossed.

Note: You're using an older syntax for Scheme engravers.  I've adapted this one to use the make-engraver macro that David Kastrup introduced at some point.

Best,
David


reply via email to

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