From 196e7954c5302810ef927db49a62dfa13ec18e2b Mon Sep 17 00:00:00 2001 From: Thomas Morley Date: Tue, 18 Aug 2015 23:11:12 +0200 Subject: [PATCH] fix autochange.scm when starting pitch and ref-pitch are the same --- scm/autochange.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scm/autochange.scm b/scm/autochange.scm index 5810f32..26199f6 100644 --- a/scm/autochange.scm +++ b/scm/autochange.scm @@ -32,10 +32,19 @@ (pitch (if (pair? notes) (ly:event-property (car notes) 'pitch) #f)) - (dir (if pitch - (sign - (- (ly:pitch-steps pitch) (ly:pitch-steps ref-pitch))) - 0))) + (dir (cond ((and pitch + (= (ly:pitch-steps ref-pitch) + (ly:pitch-steps + (ly:music-property + (car + (extract-named-music music 'NoteEvent)) + 'pitch)))) + 1) + (pitch + (sign + (- (ly:pitch-steps pitch) + (ly:pitch-steps ref-pitch)))) + (else 0)))) ;; tail recursive. (if (and (not (= dir 0)) (not (= dir prev-dir))) -- 1.9.1