summaryrefslogtreecommitdiff
path: root/ly
diff options
context:
space:
mode:
authorCarl Sorensen <c_sorensen@byu.edu>2010-09-23 22:50:45 -0600
committerCarl Sorensen <c_sorensen@byu.edu>2010-11-12 18:54:50 -0700
commit47c3d16c5044555afa49637310a7ee324b06af51 (patch)
treecb8ebf160847ade593c3b6c30c90969c4282271a /ly
parentd97c4dfce2e61ae219544cd6213862464e82df67 (diff)
Allow user-defined predefined fretboard hash-table
Add fretboard-table argument to \storePredefined Diagram Add rule to convertrules.py Modify all predefined-*-fretboards.ly Modify regression tests Modify docs Update relevant snippets
Diffstat (limited to 'ly')
-rw-r--r--ly/declarations-init.ly6
-rw-r--r--ly/predefined-fretboards-init.ly20
2 files changed, 21 insertions, 5 deletions
diff --git a/ly/declarations-init.ly b/ly/declarations-init.ly
index bddd34e582..403bb0d01d 100644
--- a/ly/declarations-init.ly
+++ b/ly/declarations-init.ly
@@ -39,6 +39,9 @@ pitchnames = #default-language
\include "chord-repetition-init.ly"
+#(define default-fret-table (make-hash-table 101))
+#(define chord-shape-table (make-hash-table 29))
+
% declarations for standard directions
left = #-1
right = #1
@@ -83,9 +86,6 @@ escapedBiggerSymbol = #(make-span-event 'DecrescendoEvent START)
escapedSmallerSymbol = #(make-span-event 'CrescendoEvent START)
-#(define default-fret-table (make-hash-table 100))
-#(define chord-shape-table (make-hash-table 100))
-
\include "scale-definitions-init.ly"
melisma = #(context-spec-music (make-property-set 'melismaBusy #t) 'Bottom)
diff --git a/ly/predefined-fretboards-init.ly b/ly/predefined-fretboards-init.ly
index 9e91ed2220..d190430fb2 100644
--- a/ly/predefined-fretboards-init.ly
+++ b/ly/predefined-fretboards-init.ly
@@ -42,12 +42,28 @@ hash with the key @var{(cons key-symbol tuning)}.")
#(define (chord-shape shape-code tuning)
(get-chord-shape shape-code tuning chord-shape-table))
+% scheme function for copying/creating fretboard tables
+
+#(define (make-fretboard-table . rest)
+ "Create a new fretboard table. @code{rest} is an optional table name.
+If present, the new fretboard table starts as a copy of the fretboard
+table @code{rest}."
+ (if (null? rest)
+ (make-hash-table 101)
+ (let ((source-table (car rest)))
+ (hash-fold
+ (lambda (key value tab)
+ (hash-set! tab key value)
+ tab)
+ (make-hash-table 101)
+ source-table))))
+
% music function for adding a predefined diagram to
% fretboard-table
storePredefinedDiagram =
-#(define-music-function (parser location
- fretboard-table chord tuning diagram-definition)
+#(define-music-function
+ (parser location fretboard-table chord tuning diagram-definition)
(hash-table? 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}.")