X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdefine-music-callbacks.scm;h=0683abdb152b9927d625d6dde55ca1fa07341dbb;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=42aaf58ace30842dc9029a51c40cf3b21911f8b9;hpb=cf137655b7aee9988ef536d6fa5e38d279ee73cf;p=lilypond.git diff --git a/scm/define-music-callbacks.scm b/scm/define-music-callbacks.scm index 42aaf58ace..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--2012 Han-Wen Nienhuys +;;;; Copyright (C) 1998--2015 Han-Wen Nienhuys ;;;; Jan Nieuwenhuizen ;;;; Neil Puttock ;;;; Carl Sorensen @@ -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)))