]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-music-callbacks.scm
Doc: Clarify value of space-alist's `next-note' element if not set
[lilypond.git] / scm / define-music-callbacks.scm
index 60d7d35124687f7cd60980ce2c42490f5560f52c..667a7c631505aa85556721845a122b6dd2aa37a1 100644 (file)
@@ -114,4 +114,16 @@ to be used by the sequential-iterator"
                  (ly:context-set-property!
                   context 'measureLength new-measure-length))))
             'Timing)
-           'Score))))
+           '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)))