lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with Scheme engraver please


From: Trevor Daniels
Subject: Re: Help with Scheme engraver please
Date: Fri, 2 Sep 2016 12:05:15 +0100

Simon, you wrote Friday, September 02, 2016 1:34 AM

Hi Simon,

>On 24.08.2016 11:51, Trevor Daniels wrote:
>> David Kastrup wrote Wednesday, August 24, 2016 7:48 AM
>>> "Trevor Daniels"<address@hidden>  writes:
>>>> Prompted by the recent discussion on lute tablature, I tried coding a
>>>> Scheme engraver to create the duration grobs but quickly ran into a
>>>> problem.  I need to collect information from both a Listener and an
>>>> Acknowledger so the obvious place to build the grob is in
>>>> stop-translator-timestep,
>>> No, no, no.  stop-translator-timestep really is only for cleanup work.
>>> Stuff is no longer in working order then.  You want process-acknowledged
>>> here I think.
>>>
>>> There will always be a call to process-acknowledged whenever grobs have
>>> been created, and_reading_  stuff from grobs should be delayed until
>>> then since other acknowledgers might_write_  stuff into a grob even
>>> after your personal acknowledger has been called.  So the basic workflow
>>> is to use the various acknowledgers to_record_  the grobs you are
>>> interested in and_write_  stuff into them (or do read/write stuff that
>>> more or less is accumulative and/or really unrelated to other
>>> engravers), and then use the process-acknowledged hook for processing
>>> (including_reading_) the grobs you had recorded.
>>>
>>> You can create new grobs in process-acknowledged.  That will lead to a
>>> new cycle of acknowledger calls followed by process-acknowledged.  Only
>>> when all those cycles are over is stop-translator-timestep called, and
>>> then creating grobs is no longer an option.
>>
>> Thanks David.  That's beautifully clear.
>
> I just caught up with all the mailing lists, being back from holiday, 
> and I’d be interested in a working example for this solution. Would you 
> mind sharing it?

There already is a helpful working example in the code base.  See

input/regression/scheme-engraver.ly

This doesn't go as far as creating new grobs, so I've attached a
simple example that does.  This is a bit of a hack, used as part of
a learning process, and a bit messy as it evolved from an earlier
attempt, but it illustrates one way.

Actually, comments from the experts on this would be very helpful.

Trevor

Attachment: duration-as-markup-5b.ly
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]