Re: [frogs] bend implementation

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]



Marc Hohl wrote Wednesday, January 20, 2010 10:11 AM

I think I begin to understand how engravers work, but there are some issues
that  aren't perfectly clear.

With IMPLEMENT_TRANSLATOR_LISTENER
I tell the engraver which triggers it. The events are defined in
scm/define-music-events.scm, so I'll put some new events for triggering
bends there.

Yes.  You need a DECLARE_TRANSLATOR_LISTENER
to declare several internal procedures relating
to the listened event.  It also declares the
 listen_<event> (Stream_event *)
method.  You will need to provide an implementation
of this to cache the events.

IMPLEMENT_TRANSLATOR_LISTENER implements the
methods declared by DECLARE_TRANSLATOR_LISTENER
and arranges for your listen_<event> method to
be called every time the required event is found
in the input stream.

The whole ACKNOWLEDGER story is still a bit foggy to me.
What does that mean if I say

ADD_ACKNOWLEDGER (My_new_engraver, note_head); ?

ADD_ACKNOWLEDGER asks for your engraver to be
notified whenever the referenced grob is created.
It arranges for your acknowledge_<grobname> method
to be called when a grob with name <grob_name>
is created and passes a ref to it.  See any span
engraver, eg slur-engraver.cc for the details.

You can see the macro definitions in lily/translator.hh
and lil/translator.ihh.  These might help you to
understand what is going on behind the scenes.

Is this the key to get informations from the corresponding note heads
which I need to calculate the coordinates for the pointed slur?

I think so, but I don't know how.

The routines like ly:calc-pointed-slur-control-points don't belong
to the engraver, they are put in another file, isn't it? And there is no
master file which tells lilypond which *-engraver.cc files are
included, so if if roll my own engraver and do 'make all', it will be
present.

Yes, if you call the correct macros it all happens
magically.  A separate file is used to contain any
routines which are (or might be) called from more
than one engraver.

Hope I've got that right!  I'm still learning too.

Trevor



---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/