Thomas Morley <[email protected]> writes: > Am Do., 9. Juli 2020 um 12:30 Uhr schrieb David Kastrup <[email protected]>: >> >> Thomas Morley <[email protected]> writes: >> >> > Hi all, >> > >> > if temporary Voices occur, then the main Voice may not contain >> > rhythmic-events for the duration of those temporary Voices. >> > I'd like to identify where the main Voice "pauses", like in this test-code: >> >> Just a vague idea: does the busyGrobs context property maintained by the >> Grob_pq_engraver help in any manner? > > Hi David, > > I tried: > > \version "2.20.0" > > #(define (print-busy-grob-info context) > (let ((busy-grobs (ly:context-property context 'busyGrobs))) > (if (pair? busy-grobs) > (for-each > (lambda (bg) > (format #t "\nAt ~a we see ~a ending at ~a, pitch is ~a" > (ly:context-current-moment context) > (cdr bg) > (car bg) > (ly:prob-property (ly:grob-property (cdr bg) 'cause) 'pitch))) > busy-grobs) > (format #t "\nAt ~a no busy grobs " > (ly:context-current-moment context))))) > > Test_busy-grob_engraver = > #(lambda (context) > (make-engraver > ((process-music this-engraver) > (print-busy-grob-info context)))) > > \new Voice > \with { > \consists \Test_busy-grob_engraver > } > { > %% mom 0 > b1\startTextSpan\(( > %% mom 1 > \new Voice c' > %% mom 2 > d'\stopTextSpan)\) > %% mom 3 > } > > ==> > At #<Mom 0> no busy grobs > At #<Mom 1> we see #<Grob NoteHead > ending at #<Mom 1>, pitch is #<Pitch b > > At #<Mom 2> no busy grobs > At #<Mom 3> we see #<Grob NoteHead > ending at #<Mom 3>, pitch is #<Pitch d' > > > Which is very nice at first sight. > > Alas, in IR busyGrobs is described as: > " > busyGrobs (list) > > A queue of (end-moment . grob) cons cells. This is for internal (C++) > use only. This property contains the grobs which are still busy (e.g. > note heads, spanners, etc.)." > > In the above posted output I miss the spanners, though. To be clear, > in my use-case I'll _wish_ to disregard spanners. I'm only interested > in rhythmic-events, including skip-events. > Can I rely on the busyGrobs-description being wrong?
I checked. Grob_pq_engraver listens to everything with grob-interface. The internals guide rather looks like this would also concern spanners. However, the only grobs that are being entered are ones having a non-zero duration (most spanners don't but rather have start/end events) and that don't have the multi-measure-interface (multi-measure rests are one example of spanners with a duration). I am not sure just what this may then leave in terms of spanners. I cannot really think of one off the bat, but there is nothing explicitly prohibiting it. > Furthermore, I think I need to do some settings in > stop-translation-timestep. There the output would be different, > 'busyGrobs is never '(), according to my tests. > So I would need to read 'busyGrobs in process-music and carry over the > results to stop-translation-timestep to rely on it. > If busyGrobs may contain spanners or other not-rhythmic-events I'd > need to do some selections. > > Thus the question is, whats cheaper: > (1) calculating, based on current-moment and 'length of the > rhythmic-event (as in my initial post)? > (2) reading busyGrobs, move the result, probably select for rhythmic > grobs? Would this work for skips as well? Skips aren't grobs, are they? > Any advice? Not really. That was just something I remembered that seemed related to the task you are trying to do. The only engravers that look at busyGrobs seem to be Lyric_engraver , Rest_collision_engraver , and Forbid_line_break_engraver . It's pretty obscure. -- David Kastrup
