;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
-;; (name . (glyph clef-position octavation))
+;; (name . (glyph clef-position transposition))
;;
-;; -- the name clefOctavation is misleading. The value 7 is 1 octave,
-;; not 7 Octaves.
+;; -- the name clefTransposition is a bit misleading. Value 7 means
+;; a transposition of an octave, not a seventh.
(define-public supported-clefs
'(("treble" . ("clefs.G" -2 0))
("violin" . ("clefs.G" -2 0))
"Generate the clef setting commands for a clef with name @var{clef-name}."
(define (make-prop-set props)
(let ((m (make-music 'PropertySet)))
- (map (lambda (x) (set! (ly:music-property m (car x)) (cdr x))) props)
+ (for-each (lambda (x) (set! (ly:music-property m (car x)) (cdr x))) props)
m))
(let ((e '())
- (c0 0)
- (oct 0)
- (style 'default)
- (match (string-match "^(.*)([_^])([^0-9a-zA-Z]*)([1-9][0-9]*)([^0-9a-zA-Z]*)$" clef-name)))
+ (c0 0)
+ (oct 0)
+ (style 'default)
+ (match (string-match "^(.*)([_^])([^0-9a-zA-Z]*)([1-9][0-9]*)([^0-9a-zA-Z]*)$" clef-name)))
(if match
- (begin
- (set! clef-name (match:substring match 1))
- (set! oct
- (* (if (equal? (match:substring match 2) "^") -1 1)
- (- (string->number (match:substring match 4)) 1)))
+ (begin
+ (set! clef-name (match:substring match 1))
+ (set! oct
+ (* (if (equal? (match:substring match 2) "^") -1 1)
+ (- (string->number (match:substring match 4)) 1)))
(set! style
(cond ((equal? (match:substring match 3) "(") 'parenthesized)
((equal? (match:substring match 3) "[") 'bracketed)
(else style)))))
(set! e (assoc-get clef-name supported-clefs))
(if e
- (let* ((prop-list `(((symbol . clefGlyph) (value . ,(car e)))
+ (let* ((prop-list `(((symbol . clefGlyph) (value . ,(car e)))
((symbol . middleCClefPosition)
(value . ,(+ oct
(cadr e)
(assoc-get (car e) c0-pitch-alist))))
((symbol . clefPosition) (value . ,(cadr e)))
- ((symbol . clefOctavation) (value . ,(- oct)))))
- ;; the clefOctavationStyle property is set only when
+ ((symbol . clefTransposition) (value . ,(- oct)))))
+ ;; the clefTranspositionStyle property is set only when
;; not 'default to calm display-lily-tests.scm
(prop-list (if (eq? style 'default)
prop-list
(append
- prop-list
- `(((symbol . clefOctavationStyle)
- (value . ,style))))))
- (musics (map make-prop-set prop-list))
- (recalc-mid-C (make-music 'ApplyContext))
- (seq (make-music 'SequentialMusic
- 'elements (append musics (list recalc-mid-C))))
- (csp (make-music 'ContextSpeccedMusic)))
- (set! (ly:music-property recalc-mid-C 'procedure) ly:set-middle-C!)
- (context-spec-music seq 'Staff))
- (begin
- (ly:warning (_ "unknown clef type `~a'") clef-name)
- (ly:warning (_ "supported clefs: ~a")
- (string-join
- (sort (map car supported-clefs) string<?)))
- (make-music 'Music)))))
+ prop-list
+ `(((symbol . clefTranspositionStyle)
+ (value . ,style))))))
+ (musics (map make-prop-set prop-list))
+ (recalc-mid-C (make-music 'ApplyContext))
+ (seq (make-music 'SequentialMusic
+ 'elements (append musics (list recalc-mid-C))))
+ (csp (make-music 'ContextSpeccedMusic)))
+ (set! (ly:music-property recalc-mid-C 'procedure) ly:set-middle-C!)
+ (context-spec-music seq 'Staff))
+ (begin
+ (ly:warning (_ "unknown clef type `~a'") clef-name)
+ (ly:warning (_ "supported clefs: ~a")
+ (string-join
+ (sort (map car supported-clefs) string<?)))
+ (make-music 'Music)))))
(define-public (make-cue-clef-set clef-name)
"Generate the clef setting commands for a cue clef with name
'((clefGlyph . cueClefGlyph)
(middleCClefPosition . middleCCuePosition)
(clefPosition . cueClefPosition)
- (clefOctavation . cueClefOctavation)
- (clefOctavationStyle . cueClefOctavationStyle)))
+ (clefTransposition . cueClefTransposition)
+ (clefTranspositionStyle . cueClefTranspositionStyle)))
(let ((clef (make-clef-set clef-name)))
(for-each
(lambda (m)
(make-cue-clef-set "treble_(8)")))
;; a function to add new clefs at runtime
-(define-public (add-new-clef clef-name clef-glyph clef-position octavation c0-position)
+(define-public (add-new-clef clef-name clef-glyph clef-position transposition c0-position)
"Append the entries for a clef symbol to supported clefs and
@code{c0-pitch-alist}."
(set! supported-clefs
- (acons clef-name (list clef-glyph clef-position octavation) supported-clefs))
+ (acons clef-name (list clef-glyph clef-position transposition) supported-clefs))
(set! c0-pitch-alist
(acons clef-glyph c0-position c0-pitch-alist)))