1 ;;;; This file is part of LilyPond, the GNU music typesetter.
3 ;;;; Copyright (C) 2008--2015 Carl D. Sorensen <c_sorensen@byu.edu>
5 ;;;; LilyPond is free software: you can redistribute it and/or modify
6 ;;;; it under the terms of the GNU General Public License as published by
7 ;;;; the Free Software Foundation, either version 3 of the License, or
8 ;;;; (at your option) any later version.
10 ;;;; LilyPond is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;;;; GNU General Public License for more details.
15 ;;;; You should have received a copy of the GNU General Public License
16 ;;;; along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
19 (define-public (parse-terse-string terse-definition)
20 "Parse a @code{fret-diagram-terse} definition string @var{terse-definition}
21 and return a marking list, which can be used with a fretboard grob."
22 (cdr (fret-parse-terse-definition-string (list '()) terse-definition)))
24 (define-public (get-chord-shape shape-code tuning base-chord-shapes)
25 "Return the chord shape associated with @var{shape-code} and
26 @var{tuning} in the hash-table @var{base-chord-shapes}."
27 (let ((hash-handle (hash-get-handle base-chord-shapes
28 (cons shape-code tuning))))
33 (define-public (offset-fret fret-offset diagram-definition)
34 "Add @var{fret-offset} to each fret indication in
35 @var{diagram-definition} and return the resulting verbose
36 @code{fret-diagram-definition}."
37 (let ((verbose-definition
38 (if (string? diagram-definition)
39 (parse-terse-string diagram-definition)
42 (let* ((code (car item))
43 (nth (assq-ref '((barre . 3) (capo . 1) (place-fret . 2))
46 ;; offset nth element of item by offset-fret
47 ;; without modifying the original list but
49 (let ((tail (list-tail item nth)))
50 (append! (list-head item nth)
51 (cons (+ (car tail) fret-offset)