]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/define-music-callbacks.scm
Run grand replace for 2015.
[lilypond.git] / scm / define-music-callbacks.scm
index e9fe53eb1b0a253e85d1af3b1d05d20ce767fae0..0683abdb152b9927d625d6dde55ca1fa07341dbb 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; This file is part of LilyPond, the GNU music typesetter.
 ;;;;
-;;;; Copyright (C) 1998--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;; Copyright (C) 1998--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;;;                 Neil Puttock <n.puttock@gmail.com>
 ;;;;                 Carl Sorensen <c_sorensen@byu.edu>
@@ -102,19 +102,7 @@ to be used by the sequential-iterator"
                            structure))
                       (beaming-exception
                        (beam-exceptions fraction time-signature-settings))
-                      (new-measure-length (ly:make-moment num den))
-                      (pos (ly:context-property context 'measurePosition)))
-                 ;;\time is OK at a negative measurePosition (after \partial),
-                 ;;but at a positive position it's probably a mistake, so warn
-                 ;;(like a barcheck) and reset it to 0 to prevent errors.
-                 (if (> (ly:moment-main pos) 0)
-                     (begin
-                       (if (not (ly:context-property context 'ignoreBarChecks #f))
-                           (ly:music-warning music
-                                             (_ "\\time in mid-measure at ~A")
-                                             (ly:moment-main pos)))
-                       (ly:context-set-property!
-                        context 'measurePosition (ly:make-moment 0))))
+                      (new-measure-length (ly:make-moment num den)))
                  (ly:context-set-property!
                   context 'timeSignatureFraction fraction)
                  (ly:context-set-property!
@@ -126,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)))