Custon MMR engraver - another issue

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

Custon MMR engraver - another issue

Craig Dabelstein
Hi again,

When using lilypond on the command line, and trying to engrave multiple files, the multi measure rest engraver is giving this error when it moves to the second file on the list:

/Applications/LilyPond\ 2.19.83.app/Contents/Resources/bin/lilypond -dpoint-and-click -ddelete-intermediate-files --pdf *.ly


fatal error: symbol printMmrRange redefined


I've been using trial and error to try to find the problem but I really don't know where to look. Anh ideas?


Many thanks,


Craig






--
Craig Dabelstein
Owner
Maxime's Music
M: 0404884173
A: 19 Twelfth Ave,  Kedron QLD 4031, Australia
W: concertbandmusicstore.com[hidden email]

 
Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Thomas Morley-2
Am Mo., 6. Jan. 2020 um 04:16 Uhr schrieb Craig Dabelstein <[hidden email]>:
Hi again,

When using lilypond on the command line, and trying to engrave multiple files, the multi measure rest engraver is giving this error when it moves to the second file on the list:

/Applications/LilyPond\ 2.19.83.app/Contents/Resources/bin/lilypond -dpoint-and-click -ddelete-intermediate-files --pdf *.ly


fatal error: symbol printMmrRange redefined


I've been using trial and error to try to find the problem but I really don't know where to look. Anh ideas?


Many thanks,


Craig



Well, I defined a custom context-property for this engraver and implemented a fatal error, if this property is redefined  Following the method in define-context-properties.scm.
You trigger this error if you compile multiple files containing the definition.
This is a security-net, we shouldn't throw it away.
We could avoid it, if we actually reset `all-translation-properties´, though, some time ago David K. warned to do so, iirc.
I have to admit I don't remember the reasoning, though usually he has good ones...

I'll think about how to circumvent the problem.

Cheers,
  Harm



Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Craig Dabelstein
Ok Harm. Thanks for the engraver. It's brilliant.

All the best,

Craig


On Mon, 6 Jan 2020 at 20:05, Thomas Morley <[hidden email]> wrote:
Am Mo., 6. Jan. 2020 um 04:16 Uhr schrieb Craig Dabelstein <[hidden email]>:
Hi again,

When using lilypond on the command line, and trying to engrave multiple files, the multi measure rest engraver is giving this error when it moves to the second file on the list:

/Applications/LilyPond\ 2.19.83.app/Contents/Resources/bin/lilypond -dpoint-and-click -ddelete-intermediate-files --pdf *.ly


fatal error: symbol printMmrRange redefined


I've been using trial and error to try to find the problem but I really don't know where to look. Anh ideas?


Many thanks,


Craig



Well, I defined a custom context-property for this engraver and implemented a fatal error, if this property is redefined  Following the method in define-context-properties.scm.
You trigger this error if you compile multiple files containing the definition.
This is a security-net, we shouldn't throw it away.
We could avoid it, if we actually reset `all-translation-properties´, though, some time ago David K. warned to do so, iirc.
I have to admit I don't remember the reasoning, though usually he has good ones...

I'll think about how to circumvent the problem.

Cheers,
  Harm





--
Craig Dabelstein
Owner
Maxime's Music
M: 0404884173
A: 19 Twelfth Ave,  Kedron QLD 4031, Australia
W: concertbandmusicstore.com[hidden email]

 
Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Thomas Morley-2
In reply to this post by Thomas Morley-2
Hi Craig,

Am Mo., 6. Jan. 2020 um 11:05 Uhr schrieb Thomas Morley
<[hidden email]>:

>
> Am Mo., 6. Jan. 2020 um 04:16 Uhr schrieb Craig Dabelstein <[hidden email]>:
>>
>> Hi again,
>>
>> When using lilypond on the command line, and trying to engrave multiple files, the multi measure rest engraver is giving this error when it moves to the second file on the list:
>>
>> /Applications/LilyPond\ 2.19.83.app/Contents/Resources/bin/lilypond -dpoint-and-click -ddelete-intermediate-files --pdf *.ly
>>
>> fatal error: symbol printMmrRange redefined
>>
>> I've been using trial and error to try to find the problem but I really don't know where to look. Anh ideas?
>
> Well, I defined a custom context-property for this engraver and implemented a fatal error, if this property is redefined  Following the method in define-context-properties.scm.
> You trigger this error if you compile multiple files containing the definition.
> This is a security-net, we shouldn't throw it away.
> We could avoid it, if we actually reset `all-translation-properties´, though, some time ago David K. warned to do so, iirc.
> I have to admit I don't remember the reasoning, though usually he has good ones...
>
> I'll think about how to circumvent the problem.
>
> Cheers,
>   Harm
>

below you'll find an improved version.
Instead of defining a context-property, I use 'print-range as
subproperty of 'details of MultiMeasureRestNumber

You can now switch on/off by setting
\override MultiMeasureRestNumber.details.print-range = ##t or ##f
Of course you could define some shortcuts for them.

HTH,
  Harm

%% define how to format `start' and `stop'
%% for `MultiMeasureRestNumber' in the engraver
%% TODO find a method to set the values for `translate-scaled'
formatMMRNumber =
#(define-scheme-function (start stop)(integer? integer?)

#{
  \markup
    \column {
       \halign #0 #(number->string (- stop start))
%       %% value found by try and error
       \translate-scaled #'(0 . -6.5)
       \with-dimensions #empty-interval #empty-interval
       \halign #0
       \normal-text
       \fontsize #-2
       \line {
         #(number->string (1+  start))
         " - "
         #(number->string stop)
       }
    }
#})


%% TODO
%% I didn't manage to _create_ a MultiMeasureRestText-grob via
%% `ly:engraver-make-grob'
%% How to do?
%% It worked with simple TextScript ...
#(define (mmr-range-engraver context)
"Print the range of a @code{MultiMeasureRest}, if the context-property
@code{printMmrRange} is set @code{#t}."
  (let ((m-m-r-print '()))
    `((acknowledgers
        (multi-measure-interface
         . ,(lambda (engraver grob source-engraver)
            (if (eq? (grob::name grob) 'MultiMeasureRestNumber)
                (let* ((details (ly:grob-property grob 'details))
                       (print-range? (assoc-get 'print-range details)))
                  (set! m-m-r-print
                    (cons (cons grob print-range?) m-m-r-print)))))))
      (finalize
        .
        ,(lambda (trans)
          (let* ((timeSignatureFraction
                   (ly:context-property context 'timeSignatureFraction))
                 (fraction
                   (/ (car timeSignatureFraction) (cdr timeSignatureFraction))))

          (for-each
            (lambda (mmr)
              (if (and (cdr mmr) (not (null? (cdr mmr))))
                  (let* ((m-m-r-start
                           (/ (ly:moment-main
                                (grob::when (ly:spanner-bound (car mmr) LEFT)))
                              fraction))
                         (m-m-r-stop
                           (/ (ly:moment-main
                                (grob::when (ly:spanner-bound (car mmr) RIGHT)))
                              fraction)))
                    (ly:grob-set-property! (car mmr) 'text
                      (formatMMRNumber m-m-r-start m-m-r-stop)))))
            m-m-r-print)
          (set! m-m-r-print '())))))))

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXAMPLES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\layout {
  \override Score.BarNumber.break-visibility = ##(#t #t #t)
}

\score {
  {
    \time 3/4
    c'2.
    \compressFullBarRests
    R2.*14
    c'2.
    \once \override MultiMeasureRestNumber.details.print-range = ##f
    R2.*15
    c'2.
    R2.*15
    c'2.
  }
  \layout {
    \context {
      \Voice
      \consists #mmr-range-engraver
      \override MultiMeasureRestNumber.details.print-range = ##t
    }
  }
}

\score {
  {
    \time 3/4
    c'2.
    \compressFullBarRests
    R2.*14
    c'2.
    \once \override MultiMeasureRestNumber.details.print-range = ##t
    R2.*15
    c'2.
    R2.*15
    c'2.
  }
  \layout {
    \context {
      \Voice
      \consists #mmr-range-engraver
      \override MultiMeasureRestNumber.details.print-range = ##f
    }
  }
}

\score {
  {
    \time 3/4
    c'2.
    \compressFullBarRests
    R1*3/4*14
    c'2.
  }
  \layout {
    \context {
      \Voice
      \consists #mmr-range-engraver
      \override MultiMeasureRestNumber.details.print-range = ##t
    }
  }
}

\score {
  {
    c'1
    \compressFullBarRests
    R1*14
    c'1
  }
  \layout {
    \context {
      \Voice
      \consists #mmr-range-engraver
      \override MultiMeasureRestNumber.details.print-range = ##t
    }
  }
}

\score {
  {
    \time 5/8
    c'2 c'8
    \compressFullBarRests
    R1*5/8*14
    c'2 c'8
    R1*5/8*13
    c'2 c'8
  }
  \layout {
    \context {
      \Voice
      \consists #mmr-range-engraver
      \override MultiMeasureRestNumber.details.print-range = ##t
    }
  }
}

Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Kieren MacMillan
Hi Harm,

As always, great work — thanks for this fabulous addition to the ’Pond!

Best,
Kieren.
________________________________

Kieren MacMillan, composer (he/him/his)
‣ website: www.kierenmacmillan.info
‣ email: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Thomas Morley-2
Am Di., 7. Jan. 2020 um 16:25 Uhr schrieb Kieren MacMillan
<[hidden email]>:
>
> Hi Harm,
>
> As always, great work — thanks for this fabulous addition to the ’Pond!
>
> Best,
> Kieren.


Glad you like it :)

Probably I should put it into LSR, if I can solve the remaining problems:
grob::name doesn't exist in 2.18.2 (could be replaced by the older
custom `grob-name´, which is somewhere in LSR already)
Solve the TODO

Cheers,
 Harm

Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Craig Dabelstein
Brilliant work! Thanks Harm.

Craig

On Wed, 8 Jan 2020 at 07:21, Thomas Morley <[hidden email]> wrote:
Am Di., 7. Jan. 2020 um 16:25 Uhr schrieb Kieren MacMillan
<[hidden email]>:
>
> Hi Harm,
>
> As always, great work — thanks for this fabulous addition to the ’Pond!
>
> Best,
> Kieren.


Glad you like it :)

Probably I should put it into LSR, if I can solve the remaining problems:
grob::name doesn't exist in 2.18.2 (could be replaced by the older
custom `grob-name´, which is somewhere in LSR already)
Solve the TODO

Cheers,
 Harm


--
Craig Dabelstein
Owner
Maxime's Music
M: 0404884173
A: 19 Twelfth Ave,  Kedron QLD 4031, Australia
W: concertbandmusicstore.com[hidden email]

 
Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Craig Dabelstein
Hi all,

Harm, I'm getting the below error when I use the MMR. When I switch  the \override MultiMeasureRestNumber.details.print-range to false the error goes away. I tried to make a MWE but couldn't reproduce the problem.

Any ideas?

Craig


/Applications/LilyPond 2.19.83.app/Contents/Resources/share/lilypond/current/ly/init.ly:56:2: error: wrong type for argument 1. Expecting integer, found 65/4

#

(let ((book-handler (if (defined? 'default-toplevel-book-handler)

/Applications/LilyPond 2.19.83.app/Contents/Resources/share/lilypond/current/ly/init.ly:56:2: error: wrong type for argument 2. Expecting integer, found 53/4

#

(let ((book-handler (if (defined? 'default-toplevel-book-handler)


On Wed, 8 Jan 2020 at 15:26, Craig Dabelstein <[hidden email]> wrote:
Brilliant work! Thanks Harm.

Craig

On Wed, 8 Jan 2020 at 07:21, Thomas Morley <[hidden email]> wrote:
Am Di., 7. Jan. 2020 um 16:25 Uhr schrieb Kieren MacMillan
<[hidden email]>:
>
> Hi Harm,
>
> As always, great work — thanks for this fabulous addition to the ’Pond!
>
> Best,
> Kieren.


Glad you like it :)

Probably I should put it into LSR, if I can solve the remaining problems:
grob::name doesn't exist in 2.18.2 (could be replaced by the older
custom `grob-name´, which is somewhere in LSR already)
Solve the TODO

Cheers,
 Harm


--
Craig Dabelstein
Owner
Maxime's Music
M: 0404884173
A: 19 Twelfth Ave,  Kedron QLD 4031, Australia
W: concertbandmusicstore.com[hidden email]

 


--
Craig Dabelstein
Owner
Maxime's Music
M: 0404884173
A: 19 Twelfth Ave,  Kedron QLD 4031, Australia
W: concertbandmusicstore.com[hidden email]

 
Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Thomas Morley-2
Hi Crag,

Am Sa., 11. Jan. 2020 um 07:29 Uhr schrieb Craig Dabelstein <[hidden email]>:
Hi all,

Harm, I'm getting the below error when I use the MMR. When I switch  the \override MultiMeasureRestNumber.details.print-range to false the error goes away. I tried to make a MWE but couldn't reproduce the problem.

Any ideas?

Not without the code triggering the problem.

Could you send me the whole file privately?


Cheers,
  Harm
Reply | Threaded
Open this post in threaded view
|

Re: Custon MMR engraver - another issue

Thomas Morley-2
Am Sa., 11. Jan. 2020 um 07:51 Uhr schrieb Thomas Morley
<[hidden email]>:
>
> Hi Crag,

Ooops,
Hi Craig,
ofcourse

> Am Sa., 11. Jan. 2020 um 07:29 Uhr schrieb Craig Dabelstein <[hidden email]>:
>>
>> Hi all,
>>
>> Harm, I'm getting the below error when I use the MMR. When I switch  the \override MultiMeasureRestNumber.details.print-range to false the error goes away. I tried to make a MWE but couldn't reproduce the problem.
>>
>> Any ideas?
>
>
> Not without the code triggering the problem.
>
> Could you send me the whole file privately?
>
>
> Cheers,
>   Harm