[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "Pausing" Voice
From: |
Thomas Morley |
Subject: |
Re: "Pausing" Voice |
Date: |
Sun, 12 Jul 2020 13:29:01 +0200 |
Am Do., 9. Juli 2020 um 12:30 Uhr schrieb David Kastrup <dak@gnu.org>:
>
> Thomas Morley <thomasmorley65@gmail.com> 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?
>
> --
> David Kastrup
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?
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?
Any advice?
Many thanks,
Harm