X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fpredefined-fretboards-init.ly;h=f205b63269ce9c9be08d476e4f58ba6f95b87273;hb=89192bb6e7e71cc438817d42f189142d4e44cc2b;hp=353c015b8c8bb4f203e957bf35aca03e560f01d5;hpb=e76cd284c11c8f80744a0913738fff4d8df41589;p=lilypond.git diff --git a/ly/predefined-fretboards-init.ly b/ly/predefined-fretboards-init.ly index 353c015b8c..f205b63269 100644 --- a/ly/predefined-fretboards-init.ly +++ b/ly/predefined-fretboards-init.ly @@ -1,48 +1,62 @@ -%%%% predefined-fretboard-init.ly +%%%% This file is part of LilyPond, the GNU music typesetter. %%%% -%%%% source file of the GNU LilyPond music typesetter +%%%% Copyright (C) 2008--2010 Carl D. Sorensen %%%% -%%%% (c) 2008 Carl D. Sorensen - -\version "2.11.56" - -%%%%% define storage structures - -% 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, +%%%% LilyPond is free software: you can redistribute it and/or modify +%%%% it under the terms of the GNU General Public License as published by +%%%% the Free Software Foundation, either version 3 of the License, or +%%%% (at your option) any later version. +%%%% +%%%% LilyPond is distributed in the hope that it will be useful, +%%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +%%%% GNU General Public License for more details. +%%%% +%%%% You should have received a copy of the GNU General Public License +%%%% along with LilyPond. If not, see . + +\version "2.12.0" + +% 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)) -