lilypond-user
[Top][All Lists]
Advanced

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

Re: Between context communication


From: Jean Abou Samra
Subject: Re: Between context communication
Date: Mon, 5 Sep 2022 22:20:58 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.0

Hi,

Quick answers to quick questions:


Le 05/09/2022 à 21:48, Kyle Baldwin a écrit :
Hello -

I'm trying to write an engraver that works in this way.

It listens for absolute-dynamic events and text script and hairpin/dynamic-text-spanner events with a custom event name (ExpressiveTextEvent) and do some formatting.  If the text is by itself, it's italicized and put below the staff. If there is a dynamic event, it creates a new stencil with dynamic + text. If both the absolute and spanner exist, put the text below the spanner. There is also an option on the Expressive text where it will force the text to go above the staff. (All inspired by Gould 495)

Everything works great as long as I have everything on the same staff. However, I would like to keep my dynamics and my notes separate in a << \Staff \Dynamics>> setup.  In this way, I can put the engraver on the Score and everything works well. But I am unsure how to expand this to a score with multiple sets of << \Staff \Dynamics>>.

Three quick questions which maybe make it seem like I've missed something rudimentary.

Is there an easy way to access the child contexts of a context through scheme in order to record names and make pairs?




I think the most straightforward way would be to acknowledge their respective VerticalAxisGroup grobs (characterized by hara-kiri-group-spanner-interface).

(acknowledgers
 ((hara-kiri-group-spanner-interface engraver grob source-engraver)
    ... (ly:translator-context source-engraver) ...))

Note that ly:translator-context is new in 2.23.


Can I even access the source contexts in either of the listener or acknowledger sections of an engraver?


Listeners, no. Acknowledgers, yes, with ly:translator-context as shown
above.


Would it be easiest to just create a new context type that wraps the music + dynamics and just put the custom engraver on that? Any other ideas?


Wrapping in a custom context type is what I would personally do.

Best,
Jean




reply via email to

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