]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/predefined-fretboards-init.ly
Add docstrings to functions in music-functions-init.ly; from Kieren.
[lilypond.git] / ly / predefined-fretboards-init.ly
index c8b7ff073146d47b562c8ceca88effa8e8a53b45..d0f861a40237736e5cb065512dcf669178dc74f0 100644 (file)
@@ -2,45 +2,50 @@
 %%%%
 %%%% source file of the GNU LilyPond music typesetter
 %%%%
-%%%% (c) 2008 Carl D. Sorensen <c_sorensen@byu.edu>
+%%%% (c) 2008--2009 Carl D. Sorensen <c_sorensen@byu.edu>
 
-%%%%% define storage structures
+\version "2.12.0"
 
-% base-chord-shapes is an alist of chord shapes
-% in the form of fret-diagram-terse strings with
-% scheme symbols as keys.  For convenience, the
-% symbols are LilyPond chordmode chord descriptions,
+% chord-shape-table is a hash-table of chord shapes
+% in the form of diagram-descriptions that can be
+% fret-diagram-verbose markup-llsts or
+% fret-diagram-terse strings.
+% The hash keys are pairs of scheme symbols and
+% string tunings.  For convenience, the symbols in
+% this file are LilyPond chordmode chord descriptions,
 % but that is unnecessary.
 
-#(define base-chord-shapes '())
-
-
 % music function for adding a chord shape to
-% base-chord-shapes
+% chord-shape-table
 
 addChordShape =
-#(define-music-function (parser location key-symbol shape-string)
-   (symbol? string?)
-   (set! base-chord-shapes 
-           (acons key-symbol shape-string base-chord-shapes))
+#(define-music-function (parser location key-symbol tuning shape-definition)
+   (symbol? pair? string-or-pair?)
+   (_i "Add chord shape @var{shape-definition} to the @var{chord-shape-table}
+hash with the key @var{(cons key-symbol tuning)}.")
+   (hash-set! chord-shape-table
+               (cons key-symbol tuning)
+               shape-definition)
    (make-music 'SequentialMusic 'void #t))
 
-% for convenience, to eliminate storage list in .ly references
-
-#(define (chord-shape shape-code)
-   (get-chord-shape shape-code base-chord-shapes))
+#(define (chord-shape shape-code tuning)
+   (get-chord-shape shape-code tuning chord-shape-table))
 
 % music function for adding a predefined diagram to
 % fretboard-table
 
 storePredefinedDiagram =
-#(define-music-function (parser location chord tuning terse-definition)
-  (ly:music? list? string?)
+#(define-music-function (parser location chord tuning diagram-definition)
+  (ly:music? pair? string-or-pair?)
+  (_i "Add predefined fret diagram defined by @var{diagram-definition}
+  for the chord pitches @var{chord} and the stringTuning @var{tuning}.")
   (let* ((pitches (event-chord-pitches 
                     (car (extract-named-music chord 'EventChord))))
-         (hash-key (cons tuning pitches)))
+         (hash-key (cons tuning pitches))
+         (verbose-definition (if (string? diagram-definition)
+                                 (parse-terse-string diagram-definition)
+                                 diagram-definition)))
   (hash-set! fretboard-table 
              hash-key 
-             (parse-terse-string terse-definition)))
+             verbose-definition))
   (make-music 'SequentialMusic 'void #t))
-