lilypond-user
[Top][All Lists]
Advanced

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

Re: Checkpoints (was re: Adding durations (for \after))


From: Jean Abou Samra
Subject: Re: Checkpoints (was re: Adding durations (for \after))
Date: Fri, 18 Nov 2022 11:58:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1

Le 17/11/2022 à 17:50, Joel C. Salomon a écrit :
Yes.  And I already have tags for MIDI vs print output, so I can give different checks for the version with unrolled repeats.

A complication is that I've copied the piece so it produces scoreA, scoreB, scoreC, and a combined scoreABC, and it's only in the long combined score that I'm getting trouble; and I guess I can try adding another tag group.  But everything *looks* visually in the right bars....

Checkpoints would also allow for finer granularity.  But now that I've thought my way through how to use `\barNumberCheck`, I'll try the tool I actually have rather than wishing for a tool that doesn't exist.



Well, it's not too hard to implement them.



\version "2.23.81"

#(define-event-class 'event 'StreamEvent) % cough, how is this supposed to work?

checkpoint =
#(define-music-function (label) (symbol?)
   (make-music 'Event 'checkpoint label))

\layout {
  \context {
    \Score
    \consists
      #(lambda (context)
         (let ((seen (make-hash-table))
               (new (make-hash-table))
               (warned (make-hash-table)))
           (make-engraver
            (listeners
             ((event engraver event)
              (let ((checkpoint (ly:event-property event 'checkpoint #f)))
                (when checkpoint
                  (let ((previous-ev (hashq-ref seen checkpoint)))
                    (if previous-ev
                        (when (not (hashq-ref warned checkpoint))
                          (ly:event-warning
                           event
                           "checkpoint ~a already seen at an earlier point"
                           checkpoint)
                          (ly:event-warning
                           previous-ev
                           "first seen here")
                          (hashq-set! warned checkpoint #t))
                        (hashq-set! new checkpoint event)))))))
            ((stop-translation-timestep engraver)
             (hash-for-each
              (lambda (k v)
                (hashq-set! seen k v))
              new)
             (hash-clear! new)))))
  }
}

<<
  \new Staff {
    c'1 \checkpoint A c'1 c'1 \checkpoint B c'1 c'1 \checkpoint C
  }
  \new Staff {
    e'1 \checkpoint A e'1 e'1 \checkpoint B c'1 \checkpoint C c'1
  }
  \new Staff {
    c'1 \checkpoint A c'1 \checkpoint B c'1 \checkpoint C c'1 c'1
  }
>>




Best,
Jean

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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