[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating LilyPond Object Models
From: |
Paul Morris |
Subject: |
Re: Creating LilyPond Object Models |
Date: |
Fri, 1 May 2015 11:05:29 -0400 |
> On Apr 26, 2015, at 11:16 AM, Paul Morris <address@hidden> wrote:
>
> In short, “listeners” respond to particular stream events:
> http://lilypond.org/doc/v2.18/Documentation/internals/music-classes
> while “acknowledgers” respond to particular grobs that have been “announced”
> by other engravers (that created the grobs based on the stream events that
> they “listened” to). This process of acknowledging grobs happens through
> grob interfaces:
> http://lilypond.org/doc/v2.18/Documentation/internals/graphical-object-interfaces
Something else I thought I’d add to this thread. You can access the stream
event that is the cause of a grob using "(event-cause grob)". So in many cases
that can be used instead of listeners. An example is below.
Cheers,
-Paul
\version "2.18.2"
#(define Some_custom_engraver
(make-engraver
(acknowledgers
((key-signature-interface engraver grob source-engraver)
(display grob) (newline)
(display (event-cause grob)) (newline)
;; do something with key-signature grobs
)
((note-head-interface engraver grob source-engraver)
(display grob)(newline)
(display (event-cause grob)) (newline)
;; do something with note-head grobs
))))
\new Staff \with {
\consists \Some_custom_engraver
}{
\key c \major
c'1
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Creating LilyPond Object Models,
Paul Morris <=