[ << Programming work ] | [Top][Contents][Index][ ? ] | [ Release work >> ] | ||
[ < Listening to music events ] | [ Up : Engraver tutorial ] | [ Engraver declaration/documentation > ] |
10.11.5 Acknowledging grobs
Some engravers also need information from grobs as they are created and as they terminate. The mechanism and methods to obtain this information are set up by the macros:
-
DECLARE_ACKNOWLEDGER (grob_interface)
-
DECLARE_END_ACKNOWLEDGER (grob_interface)
where grob_interface is an interface supported by the
grob(s) which should be acknowledged. For example, the following
code would declare acknowledgers for a NoteHead
grob (via the
note-head-interface
) and any grobs which support the
side-position-interface
:
DECLARE_ACKNOWLEDGER (note_head)
DECLARE_ACKNOWLEDGER (side_position)
The DECLARE_END_ACKNOWLEDGER ()
macro sets up a spanner-specific
acknowledger which will be called whenever a spanner ends.
Following declaration of an acknowledger, the method is coded as follows:
void Engraver_name::acknowledge_interface_name (Grob_info info) { ...body of acknowledger method... }
Acknowledge functions are called in the order engravers are
\consist
-ed (the only exception is if you set
must-be-last
to #t
).
If useful things are to be done to the acknowledged grobs, this
should be deferred until all the acknowledging has finished, i.e.,
store the acknowledged grobs and process the information in a
process-acknowledged ()
or stop-translation-timestep ()
function.
[ << Programming work ] | [Top][Contents][Index][ ? ] | [ Release work >> ] | ||
[ < Listening to music events ] | [ Up : Engraver tutorial ] | [ Engraver declaration/documentation > ] |