X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fchord-entry.scm;h=ec95dff287f0ba2385d79702bfcb73754d210ec2;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=0ea8e032a0e774bb95265e15df406739979e40db;hpb=40aac0ae57ee113faa860ba221d83d9e6312173e;p=lilypond.git diff --git a/scm/chord-entry.scm b/scm/chord-entry.scm index 0ea8e032a0..ec95dff287 100644 --- a/scm/chord-entry.scm +++ b/scm/chord-entry.scm @@ -1,6 +1,6 @@ ;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; Copyright (C) 2004--2014 Han-Wen Nienhuys +;;;; Copyright (C) 2004--2015 Han-Wen Nienhuys ;;;; ;;;; LilyPond is free software: you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ ;;;; along with LilyPond. If not, see . ;; for define-safe-public when byte-compiling using Guile V2 -(use-modules (scm safe-utility-defs)) +(use-modules (scm safe-utility-defs) (ice-9 receive)) (define-public (construct-chord-elements root duration modifications) "Build a chord on root using modifiers in @var{modifications}. @@ -174,26 +174,42 @@ the bass specified. (define (make-chord-elements pitches bass duration inversion original-inv-pitch) "Make EventChord with notes corresponding to PITCHES, BASS and -DURATION, and INVERSION." - (define (make-note-ev pitch) - (make-music 'NoteEvent - 'duration duration - 'pitch pitch)) - (let ((nots (map make-note-ev pitches)) - (bass-note (if bass (make-note-ev bass) #f)) - (inv-note (if inversion (make-note-ev inversion) #f))) - (if bass-note - (begin - (set! (ly:music-property bass-note 'bass) #t) - (set! nots (cons bass-note nots)))) - (if inv-note - (begin - (set! (ly:music-property inv-note 'inversion) #t) - (set! (ly:music-property inv-note 'octavation) - (- (ly:pitch-octave inversion) - (ly:pitch-octave original-inv-pitch))) - (set! nots (cons inv-note nots)))) - nots)) +DURATION, and INVERSION. Notes above INVERSION are transposed downward +along with the inversion as long as they end up below at least one +non-inverted note." + (define (make-note-ev pitch . rest) + (apply make-music 'NoteEvent + 'duration duration + 'pitch pitch + rest)) + (cond (inversion + (let* ((octavation (- (ly:pitch-octave inversion) + (ly:pitch-octave original-inv-pitch))) + (down (ly:make-pitch octavation 0 0))) + (define (invert p) (ly:pitch-transpose down p)) + (define (make-inverted p . rest) + (apply make-note-ev (invert p) 'octavation octavation rest)) + (receive (uninverted high) + (span (lambda (p) (ly:pitch rather than + ;; or + (values '() high) + (span (lambda (p) + (ly:pitch