lilypond-user
[Top][All Lists]
Advanced

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

Re: how to read out final "whichBar"


From: Maurits Lamers
Subject: Re: how to read out final "whichBar"
Date: Sat, 4 Nov 2017 14:18:03 +0100

That works like a dream, thanks a lot! 
I will be using only stop-translation-timestep as it contains every barline 
that needs to be used, and as I am using the finalize listener for my output, 
the acknowledges are too late. Just one thing: I noticed that the output from 
the code in the acknowledgers part is reversed, ie that the "|." I have at the 
end is being printed first.
Is that to be expected?

cheers

Maurits

> Op 3 nov. 2017, om 15:29 heeft Thomas Morley <address@hidden> het volgende 
> geschreven:
> 
> 2017-11-03 9:42 GMT+01:00 Maurits Lamers <address@hidden>:
>> Hi,
>> 
>> I have been using scheme based engravers to capture all kinds of music 
>> events. Until now I have dealt with bar lines by reading out the whichBar 
>> property on the context of an event through
>> 
>> (ly:context-property (ly:translator-context engraver) 'whichBar)
>> 
>> However, this doesn't work for the final bar sign. I have also tried to read 
>> out the translator object given to the finalize function, but when I read 
>> out the whichBar property, it is invariably empty. What would be the best 
>> way to figure out which type of bar is used at the end of a piece?
>> 
>> Thanks in advance!
>> 
>> cheers
>> 
>> Maurits
> 
> You could do:
> 
> \version "2.19.65"
> 
> \score {
>  {
>    r2 r
>    \break
>    \bar "S"
>    R1
>    \bar "|."
>  }
>  \layout {
>    \context {
>      \Staff
>      \consists
>      #(make-engraver
>         ((stop-translation-timestep engraver)
>          (format #t "\nwhichBar: ~a"
>                     (ly:context-property
>                       (ly:translator-context engraver)
>                       'whichBar)))
>         (acknowledgers
>          ((bar-line-interface engraver grob source-engraver)
>            (ly:grob-set-property! grob 'after-line-breaking
>              (lambda (grob)
>                (format #t "\nglyph: ~a"
>                           (ly:grob-property grob 'glyph))
>                (format #t "\nglyph-name: ~a"
>                           (ly:grob-property grob 'glyph-name)))))))
>    }
>  }
> }
> 
> 
> Note the difference for the grob-properties, due to line-break.
> 
> Cheers,
>  Harm




reply via email to

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