From 6071d12f8cb830c5761445c45ac76d942638b57d Mon Sep 17 00:00:00 2001 From: David Nalesnik Date: Sat, 5 Jul 2014 20:01:40 -0500 Subject: [PATCH] Issue 3992: Fix dodecaphonic-no-repeat Incorporate renaming of localKeySignature to localAlterations. The function dodecaphonic-no-repeat-rule now considers alterations. A pitch which overlaps the same pitch begun earlier should not receive an accidental. Improvement to code comments. Improve code formatting. --- scm/music-functions.scm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 791547706f..83cee5ce99 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -1580,7 +1580,8 @@ For convenience, returns @code{0} if entry is @code{#f}." 0)) (define-public (find-pitch-entry keysig pitch accept-global accept-local) - "Return the first entry in @var{keysig} that matches @var{pitch}. + "Return the first entry in @var{keysig} that matches @var{pitch} +by notename and octave. Alteration is not considered. @var{accept-global} states whether key signature entries should be included. @var{accept-local} states whether local accidentals should be included. If no matching entry is found, @var{#f} is returned." @@ -1620,15 +1621,19 @@ look at bar lines nor different accidentals at the same note name." note (just as in the dodecaphonic accidental style) @emph{except} if the note is immediately preceded by a note with the same pitch. This is a common accidental style in contemporary notation." - (let* ((keysig (ly:context-property context 'localKeySignature)) - (entry (find-pitch-entry keysig pitch #t #t))) + (let* ((keysig (ly:context-property context 'localAlterations)) + (entry (find-pitch-entry keysig pitch #f #t))) (if (not entry) - (cons #f #t) - (let* ((entrymp (key-entry-measure-position entry)) - (entrybn (key-entry-bar-number entry))) - (cons #f - (not - (and (equal? entrybn barnum) (equal? entrymp measurepos)))))))) + (cons #f #t) + (let ((entrymp (key-entry-measure-position entry)) + (entrybn (key-entry-bar-number entry)) + (entryalt (key-entry-alteration entry)) + (alt (ly:pitch-alteration pitch))) + (cons #t + (not (and (equal? entrybn barnum) + (or (equal? measurepos entrymp) + (ly:moment