]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 4099: Partcombine warning about simultaneous breathing
authorDavid Kastrup <dak@gnu.org>
Sun, 16 Nov 2014 18:31:22 +0000 (19:31 +0100)
committerDavid Kastrup <dak@gnu.org>
Mon, 24 Nov 2014 19:12:28 +0000 (20:12 +0100)
This moves the default midi-length definition of BreathingEvent to
define-music-types: it does not make sense to put default settings in
the music event itself.

ly/music-functions-init.ly
scm/define-music-callbacks.scm
scm/define-music-types.scm

index d4755cbac3ccbb952c8895212ec9723eca6a8942..182f8fdf36334b9acbbba34f33295d62531763cf 100644 (file)
@@ -253,15 +253,7 @@ bookOutputSuffix =
 breathe =
 #(define-music-function (parser location) ()
    (_i "Insert a breath mark.")
-   (make-music 'BreathingEvent
-     'midi-length
-     (lambda (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)))))
+   (make-music 'BreathingEvent))
 
 clef =
 #(define-music-function (parser location type) (string?)
index 24281a883846ac64d0e7aa6293b2657ce3ff1499..667a7c631505aa85556721845a122b6dd2aa37a1 100644 (file)
@@ -116,3 +116,14 @@ to be used by the sequential-iterator"
             'Timing)
            'Score)
           (make-music 'TimeSignatureEvent music))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Some MIDI callbacks -- is this a good place for them?
+
+(define-public (breathe::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)))
index 359e10eac1f6a4e382f9044aa5d77c88c9988738..c7984c967422d5ac672585ea9ed9fb2e09edbec6 100644 (file)
@@ -128,7 +128,7 @@ Syntax for manual control: @code{c8-[ c c-] c8}")
 Syntax: @var{note}@code{\\breathe}")
 
         (types . (general-music event breathing-event))
-        ))
+        (midi-length . ,breathe::midi-length)))
 
     (ClusterNoteEvent
      . ((description . "A note that is part of a cluster.")