[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to catch post-events inside chords in an event listener?
From: |
Valentin Petzel |
Subject: |
Re: How to catch post-events inside chords in an event listener? |
Date: |
Sun, 06 Feb 2022 23:30:44 +0100 |
Hi Lukas,
Yes, memq is totally safe here and theoretically faster. But the performance
difference is not really noticeable in usual situations. And in my opinion the
whole eq? eqv? and equal? thing is just too confusing for beginners of scheme,
so I opt so sacrifice this small theoretical gain for not potentially confusing
people trying to get into this.
Cheers,
Valentin
Am Sonntag, 6. Februar 2022, 22:52:00 CET schrieb Lukas-Fabian Moser:
> Hi Valentin,
>
> Am 06.02.22 um 20:57 schrieb Valentin Petzel:
> > one could try something like this.
>
> Yes, thanks, that's what did after David's explanations as well.
>
> In my situation (where I'm using a custom event type not covered by any
> standard engravers), I can then dispose of the dedicated listener: This
> is essentially what happens for
>
> \version "2.22"
>
> #(define (test_engraver ctx)
> (make-engraver
> (listeners
> ;;; NOT NEEDED if Tie_engraver is removed
> ; ((tie-event engraver event)
> ; (format #t "Tie encountered at ~a.\n" (ly:context-current-moment
> ctx)))
> ((note-event engraver event)
> (for-each
> (lambda (art)
> (if (memq 'tie-event (ly:event-property art 'class))
> (format #t "Tie encountered at ~a.\n"
> (ly:context-current-moment ctx))))
> (ly:event-property event 'articulations))))))
>
> \layout {
> \context {
> \Voice
> \consists #test_engraver
> \remove Tie_engraver
> }
> }
>
> {
> a4~
> <a~ g'>
> a~
> a
> }
>
> (I think it's safe to use memq instead of member.)
>
> I'm just still confused as to the terminology of event "classes" vs.
> event "types" etc. But that's something for next week...
>
> Lukas
signature.asc
Description: This is a digitally signed message part.