Use scalar instead of embedded_scm for context mod overrides.
[lilypond/mpolesky.git] / ly / predefined-fretboards-init.ly
blobd0f861a40237736e5cb065512dcf669178dc74f0
1 %%%% predefined-fretboard-init.ly
2 %%%%
3 %%%% source file of the GNU LilyPond music typesetter
4 %%%%
5 %%%% (c) 2008--2009 Carl D. Sorensen <c_sorensen@byu.edu>
7 \version "2.12.0"
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
19 % chord-shape-table
21 addChordShape =
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)
28 shape-definition)
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
35 % fretboard-table
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)
47 diagram-definition)))
48 (hash-set! fretboard-table
49 hash-key
50 verbose-definition))
51 (make-music 'SequentialMusic 'void #t))