Reviewers: thomasmorley651, Message: On 2020/03/01 10:20:01, thomasmorley651 wrote: > LGTM
I knew I forgot something. Let's see whether it's still getting picked up by Phil. Description: Make make-autochange function upwards-compatible to 2.18 This entails putting the ref-pitch argument last and making it an optional argument. Please review this at https://codereview.appspot.com/567280043/ Affected files (+8, -4 lines): M ly/music-functions-init.ly M scm/autochange.scm Index: ly/music-functions-init.ly diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index f3893fab2ffb4062d60f496e63b978195b858c7c..ab1aaf56e6b1c75c23f71e449882ed529533098c 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -186,7 +186,7 @@ assertBeamSlope = autoChange = #(define-music-function (pitch clef-1 clef-2 music) - ((ly:pitch? (ly:make-pitch 0 0)) (ly:context-mod?)(ly:context-mod?) ly:music?) + ((ly:pitch?) (ly:context-mod?) (ly:context-mod?) ly:music?) (_i "Make voices that switch between staves automatically. As an option the pitch where to switch staves may be specified. The clefs for the staves are optional as well. Setting clefs works only for implicitly instantiated @@ -197,7 +197,7 @@ staves.") (clef-2 (or clef-2 #{ \with { \clef "bass" } #}))) (make-simultaneous-music (list - (descend-to-context (make-autochange-music pitch music) 'Staff + (descend-to-context (make-autochange-music music pitch) 'Staff "up" clef-1) (context-spec-music (make-skip-music skip) 'Staff "up" clef-1) Index: scm/autochange.scm diff --git a/scm/autochange.scm b/scm/autochange.scm index 0e2e4f11e5ec4f7d6e211aca948ccc533906555c..b79c581dc138313ce1a9ef079f9a901ee58dc6a2 100644 --- a/scm/autochange.scm +++ b/scm/autochange.scm @@ -19,7 +19,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; autochange.scm - fairly related to part combining. -(define-public (make-autochange-music ref-pitch music) +(define-public (make-autochange-music music . ref-pitch) + (define ref-pitch-steps + (if (and (pair? ref-pitch) (car ref-pitch)) + (ly:pitch-steps (car ref-pitch)) + 0)) (define (generate-split-list change-moment prev-dir event-list acc) (if (null? event-list) acc @@ -34,7 +38,7 @@ #f)) (dir (if pitch (sign - (- (ly:pitch-steps pitch) (ly:pitch-steps ref-pitch))) + (- (ly:pitch-steps pitch) ref-pitch-steps)) 0))) ;; tail recursive. (if (and (not (= dir 0))