-
-;; There is also a \harp-pedal-verbose version, which
-;; takes a list of -1/0/1 directions and a possible |. Unfortunately, it has some
-;; caveats:
-;; 1) the | cannot be given as a string "|" but as a character #\| and
-;; the "o" has to be given as #\o.
-;; 2) if one wants to use directions like UP, CENTER or DOWN, one cannot use
-;; '(UP DOWN CENTER #\| ....), because the contents of that list are
-;; never evaluated to -1/0/1. Instead one has to explicitly create a
-;; list like (list UP DOWN CENTER #\| ....)
-
- (make-harp-pedal layout props (harp-pedals-parse-string definition-string)))
-
-
-(define (harp-pedals-parse-string definition-string)
- "Parse a harp pedals diagram string and return a list containing 1, 0, -1, #\\o or #\\|"
- (map (lambda (c)
- (case c
- ((#\^) 1)
- ((#\v) -1)
- ((#\-) 0)
- ((#\| #\o) c)
- (else c)))
- (string->list definition-string)))
-
-(define (harp-pedal-info pedal-list)
- (let check ((pedals pedal-list)
- (pedalcount 0)
- (dividerpositions '()))
- (if (null? pedals)
- (cons pedalcount (reverse dividerpositions))
-
- (case (car pedals)
- ((-1 0 1) (check (cdr pedals) (+ pedalcount 1) dividerpositions))
- ((#\|) (check (cdr pedals) pedalcount (cons pedalcount dividerpositions)))
- (else (check (cdr pedals) pedalcount dividerpositions))))))
-
-(define (harp-pedal-check pedal-list)
- "Perform some sanity checks for harp pedals (7 pedals, divider after third)"
- (let ((info (harp-pedal-info pedal-list)))
- ; 7 pedals:
- (if (not (equal? (car info) 7))
- (ly:warning "Harp pedal diagram contains ~a pedals rather than the usual 7." (car info)))
- ; One divider after third pedal:
- (if (null? (cdr info))
- (ly:warning "Harp pedal diagram does not contain a divider (usually after third pedal).")
- (if (not (equal? (cdr info) '(3)))
- (ly:warning "Harp pedal diagram contains dividers at positions ~a. Normally, there is only one divider after the third pedal." (cdr info))))))
-
-
-(define (make-harp-pedal layout props pedal-list)
- "Make a harp pedals diagram markup"
-
-
- ; FIXME the size variable should be defined by a prop. lookup
- (harp-pedal-check pedal-list)
-
- (let* ((size (chain-assoc-get 'size props 1.2))
- (details (chain-assoc-get 'harp-pedal-details props '()))