1 %%%% predefined-fretboard-init.ly
3 %%%% source file of the GNU LilyPond music typesetter
5 %%%% (c) 2008--2009 Carl D. Sorensen <c_sorensen@byu.edu>
9 % chord-shape-table is a hash-table of chord shapes
10 % in the form of diagram-descriptions that can be
11 % fret-diagram-verbose markup-llsts or
12 % fret-diagram-terse strings.
13 % The hash keys are pairs of scheme symbols and
14 % string tunings. For convenience, the symbols in
15 % this file are LilyPond chordmode chord descriptions,
16 % but that is unnecessary.
18 % music function for adding a chord shape to
22 #(define-music-function
(parser location key-symbol tuning shape-definition
)
23 (symbol? pair? string-or-pair?
)
24 (_i
"Add chord shape @var{shape-definition} to the @var{chord-shape-table}
25 hash with the key @var{(cons key-symbol tuning)}.")
26 (hash-set
! chord-shape-table
27 (cons key-symbol tuning
)
29 (make-music
'SequentialMusic
'void
#t
))
31 #(define
(chord-shape shape-code tuning
)
32 (get-chord-shape shape-code tuning chord-shape-table
))
34 % music function for adding a predefined diagram to
37 storePredefinedDiagram
=
38 #(define-music-function
(parser location chord tuning diagram-definition
)
39 (ly
:music? pair? string-or-pair?
)
40 (_i
"Add predefined fret diagram defined by @var{diagram-definition}
41 for the chord pitches @var{chord} and the stringTuning @var{tuning}.")
42 (let
* ((pitches
(event-chord-pitches
43 (car
(extract-named-music chord
'EventChord
))))
44 (hash-key
(cons tuning pitches
))
45 (verbose-definition
(if
(string? diagram-definition
)
46 (parse-terse-string diagram-definition
)
48 (hash-set
! fretboard-table
51 (make-music
'SequentialMusic
'void
#t
))