Hi Nathan,

On Tue, Mar 31, 2015 at 3:53 PM, Nathan Ho <when.possi...@gmail.com> wrote:

> On Mon, Mar 30, 2015 at 1:44 PM, Nathan Ho <when.possi...@gmail.com>
> wrote:
>
>> Hi list,
>>
>> What is the most up-to-date way to define my own event classes?
>>
>> I've looked at frameEngraver as a model but none of the old versions
>> seem to be working. The most up-to-date one I could find
>> (https://lists.gnu.org/archive/html/lilypond-user/2013-07/msg00373.html)
>> gives me numerous "Event class should be a list" errors and the frames
>> don't show up in the output, while this one
>> (https://lists.gnu.org/archive/html/lilypond-user/2013-07/msg00554.html)
>> spits out a few errors and segfaults. I'm using 2.19.17.
>>
>
> Not hugely surprised to see that didn't get a quick answer :)
>
> With some trial and error and fumbling around I came up with the following
> code. Unlike the frame engraver code, this returns no errors or warnings,
> but the engraver doesn't seem to notice the BangEvent at all. If I change
> the listener to listen to music-event, then bang-trigger calls four times
> (once per note) seemingly ignoring the \bang. What's going on here?
>

If you're listening to 'music-event, you'll hear all sorts of events
because it's the parent of many event-classes.  If you add an articulation
to a note, for example, you'll hear that too.  Your invocation of
define-event-class makes it the parent of bang-event.


>
> \version "2.19.17"
>
> #(define-event-class 'bang-event 'music-event)
>
> #(define bang-types
>    '(
>      (BangEvent
>       . ((description . "BANG!")
>          (types . (bang-event music-event))
>          ))
>      ))
>

You need to add 'event' to types for your event to register.  (I'd have to
investigate why.)  Also, 'music-event' should be replaced with
'general-music'.

#(define bang-types
   '(
     (BangEvent
      . ((description . "BANG!")
         (types . (general-music event bang-event))
         ))
     ))

Hope this helps!
David
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to