From: Han-Wen Nienhuys Date: Sun, 1 Dec 2002 18:26:40 +0000 (+0000) Subject: * scm/music-functions.scm (shift-one-duration-log): refactor. X-Git-Tag: release/1.7.9~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d9a979d76eba0bb4077ca3a46e3c085e6e87eff1;p=lilypond.git * scm/music-functions.scm (shift-one-duration-log): refactor. Use music-map. * input/regression/chord-tremolo.ly (texidoc): add dot test. * scm/music-functions.scm (display-music): new function (music-map): change arg order. --- diff --git a/ChangeLog b/ChangeLog index eea9b1ea84..21866ecf4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2002-12-01 Han-Wen Nienhuys + * scm/music-functions.scm (shift-one-duration-log): refactor. + Use music-map. + + * input/regression/chord-tremolo.ly (texidoc): add dot test. + * NEWS: update. * lily/font-interface.cc (get-font): take alist chain i.s.o. alist diff --git a/input/regression/chord-tremolo.ly b/input/regression/chord-tremolo.ly index f67fa4b3dc..1d02ba4852 100644 --- a/input/regression/chord-tremolo.ly +++ b/input/regression/chord-tremolo.ly @@ -22,6 +22,9 @@ stems. \break \repeat "tremolo" 4 { f'8 e } \repeat "tremolo" 2 { f e } + c4 c4 + + \repeat "tremolo" 3 { f8 e } c4 c4 c4 c4 c4 c4 c4 c4 c4 @@ -33,4 +36,4 @@ stems. } \midi { } } -%% new-chords-done %% \ No newline at end of file +%% new-chords-done %% diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 7250dac3af..434a49f641 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -35,45 +35,34 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(define-public (shift-duration-log music shift dot) - "Recurse through music, adding SHIFT to ly:duration-log and optionally +(define (shift-one-duration-log music shift dot) + " add SHIFT to ly:duration-log and optionally a dot to any note encountered. This scales the music up by a factor 2^shift * (2 - (1/2)^dot)" - (let* ((es (ly:get-mus-property music 'elements)) - (e (ly:get-mus-property music 'element)) - (n (ly:music-name music)) - (f (lambda (x) (shift-duration-log x shift dot))) - (d (ly:get-mus-property music 'duration)) - ) - ;; FIXME: broken by the great music rename. + (let* + ( + (d (ly:get-mus-property music 'duration)) + ) (if (ly:duration? d) (let* ( (cp (ly:duration-factor d)) (nd (ly:make-duration (+ shift (ly:duration-log d)) - (+ dot (duration-dot-count d)) - (car cp) - (cdr cp))) + (+ dot (ly:duration-dot-count d)) + (car cp) + (cdr cp))) ) (ly:set-mus-property! music 'duration nd) )) - - (if (pair? es) - (ly:set-mus-property! - music 'elements - (map f es))) - - (if (ly:music? e) - (ly:set-mus-property! - music 'element - (f e))) - music)) +(define-public (shift-duration-log music shift dot) + (music-map (lambda (x) (shift-one-duration-log x shift dot)) + music)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; repeats.