Bug: restarting staff destroys DynamicLineSpanner.staff-padding after line break

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug: restarting staff destroys DynamicLineSpanner.staff-padding after line break

Trevor Bača-2
Hi,

Restarting the staff during the lifespan of a multisystem
DynamicLineSpanner destroys the value of DynamicLineSpanner properties
(like staff-padding) that were set when the DynamicLineSpanner was created.

In the MWE below, the hairpin should exhibit staff-padding equal to 10
staff spaces below all four systems; but the value of staff-padding is lost
at the point (in system 2) that the staff is restarted; we see evidence of
this after the next line break (in systems 3 and 4) where no staff padding
appears.

%%% BEGIN %%%

\version "2.19.82"

\new Staff
{

    \override DynamicLineSpanner.staff-padding = 10
    c'1
    \p
    \<
    c'1
    c'1
    \break

    c'1
    \stopStaff
    \startStaff
    c'1
    c'1
    \break

    c'1
    c'1
    c'1
    \break

    c'1
    c'1
    c'1
    \f

}

\paper
{
    indent = 0
    ragged-right = ##t
    system-system-spacing.minimum-distance = 30
}

%%% END %%%

[image: restart-staff-dynamic-line-spanner-bug.png]


Thanks,

Trevor.

--
Trevor Bača
www.trevorbaca.com
soundcloud.com/trevorbaca

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond

restart-staff-dynamic-line-spanner-bug.png (51K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug: restarting staff destroys DynamicLineSpanner.staff-padding after line break

Aaron Hill
On 2019-03-06 4:55 pm, Trevor Bača wrote:

> Hi,
>
> Restarting the staff during the lifespan of a multisystem
> DynamicLineSpanner destroys the value of DynamicLineSpanner properties
> (like staff-padding) that were set when the DynamicLineSpanner was
> created.
>
> In the MWE below, the hairpin should exhibit staff-padding equal to 10
> staff spaces below all four systems; but the value of staff-padding is
> lost
> at the point (in system 2) that the staff is restarted; we see evidence
> of
> this after the next line break (in systems 3 and 4) where no staff
> padding
> appears.

staff-padding is not destroyed.  It is still set.

The issue is the broken spanners have lost their reference to the
StaffSymbol.  And Side_position_interface::aligned_side
(side-position-interface.cc:180) expects that there is a valid
StaffSymbol in order to care about staff-padding.

Add the following \override to your code and note the output:

%%%%
   \override DynamicLineSpanner.after-line-breaking = #(lambda (grob)
     (display (format "~a ~a ~a\n"
       (ly:grob-property grob 'staff-padding)
       (ly:grob-property grob 'Y-offset)
       (ly:grob-object grob 'staff-symbol))))
%%%%

> Drawing systems...10 -12.05 #<Grob StaffSymbol >
> 10 -12.05 #<Grob StaffSymbol >
> 10 -4.57775475073964 #<undefined>
> 10 -5.45702919685039 #<undefined>

You can see that the staff-padding is still 10 for all of the spanners.  
But only the first two that have a valid StaffSymbol end up with the
expected Y-offset.


-- Aaron Hill

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: Bug: restarting staff destroys DynamicLineSpanner.staff-padding after line break

David Kastrup
In reply to this post by Trevor Bača-2
Trevor Bača <[hidden email]> writes:

> Restarting the staff during the lifespan of a multisystem
> DynamicLineSpanner destroys the value of DynamicLineSpanner properties
> (like staff-padding) that were set when the DynamicLineSpanner was
> created.

It doesn't.  It's just that the DynamicLineSpanner has a relation with
the Staff it was started in.

> In the MWE below, the hairpin should exhibit staff-padding equal to 10
> staff spaces below all four systems; but the value of staff-padding is lost
> at the point (in system 2) that the staff is restarted; we see evidence of
> this after the next line break (in systems 3 and 4) where no staff padding
> appears.
>
> %%% BEGIN %%%
>
> \version "2.19.82"
>
> \new Staff
> {
>
>     \override DynamicLineSpanner.staff-padding = 10
>     c'1
>     \p
>     \<
>     c'1
>     c'1
>     \break
>
>     c'1
>     \stopStaff
>     \startStaff
>     c'1
>     c'1
>     \break
>
>     c'1
>     c'1
>     c'1
>     \break
>
>     c'1
>     c'1
>     c'1
>     \f
>
> }
>
> \paper
> {
>     indent = 0
>     ragged-right = ##t
>     system-system-spacing.minimum-distance = 30
> }
>
> %%% END %%%
>
> [image: restart-staff-dynamic-line-spanner-bug.png]

If you start a new DynamicLineSpanner like

    c'1\!
    \stopStaff
    \startStaff
    c'1\<

it will be properly spaced.  It's probably not the only spanner
unprepared to span pieces of interrupted staff symbols.

--
David Kastrup

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond
Reply | Threaded
Open this post in threaded view
|

Re: Bug: restarting staff destroys DynamicLineSpanner.staff-padding after line break

Trevor Bača-2
On Thu, Mar 7, 2019 at 2:14 AM David Kastrup <[hidden email]> wrote:

> Trevor Bača <[hidden email]> writes:
>
> > Restarting the staff during the lifespan of a multisystem
> > DynamicLineSpanner destroys the value of DynamicLineSpanner properties
> > (like staff-padding) that were set when the DynamicLineSpanner was
> > created.
>
> It doesn't.  It's just that the DynamicLineSpanner has a relation with
> the Staff it was started in.
>
> > In the MWE below, the hairpin should exhibit staff-padding equal to 10
> > staff spaces below all four systems; but the value of staff-padding is
> lost
> > at the point (in system 2) that the staff is restarted; we see evidence
> of
> > this after the next line break (in systems 3 and 4) where no staff
> padding
> > appears.
> >
> > %%% BEGIN %%%
> >
> > \version "2.19.82"
> >
> > \new Staff
> > {
> >
> >     \override DynamicLineSpanner.staff-padding = 10
> >     c'1
> >     \p
> >     \<
> >     c'1
> >     c'1
> >     \break
> >
> >     c'1
> >     \stopStaff
> >     \startStaff
> >     c'1
> >     c'1
> >     \break
> >
> >     c'1
> >     c'1
> >     c'1
> >     \break
> >
> >     c'1
> >     c'1
> >     c'1
> >     \f
> >
> > }
> >
> > \paper
> > {
> >     indent = 0
> >     ragged-right = ##t
> >     system-system-spacing.minimum-distance = 30
> > }
> >
> > %%% END %%%
> >
> > [image: restart-staff-dynamic-line-spanner-bug.png]
>
> If you start a new DynamicLineSpanner like
>
>     c'1\!
>     \stopStaff
>     \startStaff
>     c'1\<
>
> it will be properly spaced.  It's probably not the only spanner
> unprepared to span pieces of interrupted staff symbols.
>
Isn't this still a bug? Or, rather a gap in system functionality for which
no workaround exists?

Starting a new DynamicLineSpanner creates two separate hairpins:

%%% BEGIN %%%

\version "2.19.82"

\new Staff
{

    \override DynamicLineSpanner.staff-padding = 10
    c'1
    \p
    \<
    c'1
    c'1
    \break

    c'1
    \!
    \stopStaff
    \startStaff
    c'1
    \<
    c'1
    \break

    c'1
    c'1
    c'1
    \break

    c'1
    c'1
    c'1
    \f

}

\paper
{
    indent = 0
    ragged-right = ##t
    system-system-spacing.minimum-distance = 30
}

%%% END %%%

[image: two-hairpins-instead-of-one.png]

... when what's needed is one single hairpin that governs the music of all
four systems.

Or am I missing something, and there is a way to generate a single
multisystem hairpin that governs all four systems?


Trevor.

--
Trevor Bača
www.trevorbaca.com
soundcloud.com/trevorbaca

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond

two-hairpins-instead-of-one.png (54K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Bug: restarting staff destroys DynamicLineSpanner.staff-padding after line break

Thomas Morley-2
Am Mo., 11. März 2019 um 23:01 Uhr schrieb Trevor Bača <[hidden email]>:
>
> On Thu, Mar 7, 2019 at 2:14 AM David Kastrup <[hidden email]> wrote:

> > It's probably not the only spanner
> > unprepared to span pieces of interrupted staff symbols.
> >
>
> Isn't this still a bug?

In the sense David pointed out.

> Or, rather a gap in system functionality for which
> no workaround exists?

Here an attempt for a workaround.
It's not tested beyond the given example, up to you ;)

\new Staff {
  \override DynamicLineSpanner.after-line-breaking =
    #(lambda (grob)
       (let* ((staffs
                (filter
                  (lambda (e) (grob::has-interface e 'staff-symbol-interface))
                  (ly:grob-array->list
                    (ly:grob-object (ly:grob-parent grob Y) 'elements)))))

         (for-each
           (lambda (staff) (set! (ly:grob-object grob 'staff-symbol) staff))
           staffs)

         ;(format #t"\nstaff-padding: ~a\nY-offset: ~a\nstaff-symbol ~a\n"
         ;  (ly:grob-property grob 'staff-padding)
         ;  (ly:grob-property grob 'Y-offset)
         ;  (ly:grob-object grob 'staff-symbol))
           ))

    \override DynamicLineSpanner.staff-padding = 10
    c'1\p\< c'1 c'1
    \break

    c'1 \stopStaff \startStaff c'1 c'1
    \break

    c'1 c'1 c'1
    \break

    c'1 c'1 c'1\f
}

\paper {
    indent = 0
    ragged-right = ##t
}

Cheers,
  Harm

_______________________________________________
bug-lilypond mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-lilypond