X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdefine-music-callbacks.scm;h=0683abdb152b9927d625d6dde55ca1fa07341dbb;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=e9fe53eb1b0a253e85d1af3b1d05d20ce767fae0;hpb=82e74a9fbd7cde8bb2b2a0c2d2ee081bc8951afa;p=lilypond.git diff --git a/scm/define-music-callbacks.scm b/scm/define-music-callbacks.scm index e9fe53eb1b..0683abdb15 100644 --- a/scm/define-music-callbacks.scm +++ b/scm/define-music-callbacks.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 1998--2014 Han-Wen Nienhuys +;;;; Copyright (C) 1998--2015 Han-Wen Nienhuys ;;;; Jan Nieuwenhuizen ;;;; Neil Puttock ;;;; Carl Sorensen @@ -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)))