[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Part combiner warning about simultaneous breathing
From: |
Devon Schudy |
Subject: |
Re: Part combiner warning about simultaneous breathing |
Date: |
Sun, 14 Sep 2014 07:11:35 -0400 |
David Kastrup wrote:
> My guess would be that the whole articulation mechanism might be
> changed in a manner that partcombine no longer is able to consider two
> articulations as mergeable. In that case, it would likely be more than
> just breathings which are affected.
Yes: it's because that commit added the midi-length property to breath
marks (and some articulations), whose value is a function, so
partcombine can't tell they're identical.
The old definition of \breathe (without the offending property) gives
no warning:
breathe =
#(define-music-function (parser location) ()
(_i "Insert a breath mark.")
(make-music 'BreathingEvent))
The simplest fix is to make \breathe use the same (eq?) closure
instead of a new one each time, so partcombine can merge the breaths:
#(define (breath-midi-length len context)
;;Shorten by half, or by up to a second, but always by a power of 2
(let* ((desired (min (ly:moment-main (seconds->moment 1 context))
(* (ly:moment-main len) 1/2)))
(scale (inexact->exact (ceiling (/ (log desired) (log 1/2)))))
(breath (ly:make-moment (expt 1/2 scale))))
(ly:moment-sub (ly:make-moment (ly:moment-main len)) breath)))
breathe =
#(define-music-function (parser location) ()
(_i "Insert a breath mark.")
(make-music 'BreathingEvent
'midi-length breath-midi-length))
Articulations aren't affected, because they're just copied, not
created anew with a different midi-length function each time. User
code that creates custom articulations (or any music containing
closures) could have the same problem, though.