- (define (make-prop-set props)
- (let ((m (make-music 'PropertySet)))
- (map (lambda (x) (set! (ly:music-property m (car x)) (cdr x))) props)
- m))
- (let ((e '())
- (c0 0)
- (oct 0)
- (match (string-match "^(.*)([_^])([1-9][0-9]*)$" 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 3)) 1)))))
- (set! e (assoc-get clef-name supported-clefs))
- (if e
- (let* ((musics (map make-prop-set
- `(((symbol . cueClefGlyph) (value . ,(car e)))
- ((symbol . middleCCuePosition)
- (value . ,(+ oct
- (cadr e)
- (assoc-get (car e) c0-pitch-alist))))
- ((symbol . cueClefPosition) (value . ,(cadr e)))
- ((symbol . cueClefOctavation) (value . ,(- oct))))))
- (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 cue-clef-map
+ '((clefGlyph . cueClefGlyph)
+ (middleCClefPosition . middleCCuePosition)
+ (clefPosition . cueClefPosition)
+ (clefTransposition . cueClefTransposition)
+ (clefTranspositionStyle . cueClefTranspositionStyle)))
+ (let ((clef (make-clef-set clef-name)))
+ (for-each
+ (lambda (m)
+ (let ((mapped (assq-ref cue-clef-map
+ (ly:music-property m 'symbol))))
+ (if mapped
+ (set! (ly:music-property m 'symbol) mapped))))
+ (extract-named-music clef 'PropertySet))
+ clef))