1 %%%% predefined-fretboard-init.ly
3 %%%% source file of the GNU LilyPond music typesetter
5 %%%% (c) 2008 Carl D. Sorensen <c_sorensen@byu.edu>
7 %%%%% define storage structures
9 % base-chord-shapes is an alist of chord shapes
10 % in the form of fret-diagram-terse strings with
11 % scheme symbols as keys. For convenience, the
12 % symbols are LilyPond chordmode chord descriptions,
13 % but that is unnecessary.
15 #(define base-chord-shapes '())
18 % music function for adding a chord shape to
22 #(define-music-function (parser location key-symbol shape-string)
24 (set! base-chord-shapes
25 (acons key-symbol shape-string base-chord-shapes))
26 (make-music 'SequentialMusic 'void #t))
28 % for convenience, to eliminate storage list in .ly references
30 #(define (chord-shape shape-code)
31 (get-chord-shape shape-code base-chord-shapes))
33 % music function for adding a predefined diagram to
36 storePredefinedDiagram =
37 #(define-music-function (parser location chord tuning terse-definition)
38 (ly:music? list? string?)
39 (let* ((pitches (event-chord-pitches
40 (car (extract-named-music chord 'EventChord))))
41 (hash-key (cons tuning pitches)))
42 (hash-set! fretboard-table
44 (parse-terse-string terse-definition)))
45 (make-music 'SequentialMusic 'void #t))