+(define-public (make-cue-clef-set clef-name)
+ "Generate the clef setting commands for a cue clef with name
+@var{clef-name}."
+ (define cue-clef-map
+ '((clefGlyph . cueClefGlyph)
+ (middleCClefPosition . middleCCuePosition)
+ (clefPosition . cueClefPosition)
+ (clefOctavation . cueClefOctavation)
+ (clefOctavationStyle . cueClefOctavationStyle)))
+ (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))
+
+(define-public (make-cue-clef-unset)
+ "Reset the clef settings for a cue clef."
+ (map-some-music
+ (lambda (m)
+ (and (eq? (ly:music-property m 'name) 'PropertySet)
+ (make-music 'PropertyUnset
+ 'symbol (ly:music-property m 'symbol))))
+ (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)
+ "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))
+ (set! c0-pitch-alist
+ (acons clef-glyph c0-position c0-pitch-alist)))