X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fchord-repetition-init.ly;h=1e3c7ad1056dab7c36c7dca5f63c3040f01aa8c0;hb=97a0169312a260933246ab224e4f8b0969871dd5;hp=3ff4578b60da24402d4d2173809a831b87f3c358;hpb=e26f468ce5bdb4738bb34d6ad200cd888c6011ac;p=lilypond.git diff --git a/ly/chord-repetition-init.ly b/ly/chord-repetition-init.ly index 3ff4578b60..1e3c7ad105 100644 --- a/ly/chord-repetition-init.ly +++ b/ly/chord-repetition-init.ly @@ -1,34 +1,41 @@ -\version "2.13.8" +%%% -*- Mode: Scheme -*- +\version "2.19.22" %{ -Two functions define the chord repetition behavior, and may -be invoked by the user to customize it. + Chord repetition behavior is not customizable in the parser. That + is due to it usually being done by the toplevel music handler + affecting every bit of music at the same time, not closely related + to music input. Customized behavior is instead accomplished by + calling \chordRepeats explicitly on some music list with a list of + event types you wish to keep by default (if any events of that kind + are found already on the repeat chord, however, they still get + removed from the original). -ly:parser-set-repetition-symbol - set the chord repetition shortcut. - `q' is the default value set in this file. - -ly:parser-set-repetition-function - set the function that is invoked when a chord repetition symbol - is encountered by the parser: a three argument function - (previous-chord, duration, list of articulations) which is supposed - to return a new chord. - `default-repeat-chord' is the default function set in this file. + The default behavior is straightforward: don't keep anything but the + rhythmic events themselves. %} -#(define-public (default-repeat-chord previous-chord duration articulations) - "Copy the previous chord, filter out events which are not notes, set the -chord duration, add articulations." - (let ((new-chord (ly:music-deep-copy previous-chord))) - (set! (ly:music-property new-chord 'elements) - (append! articulations - (filter (lambda (event) - (eqv? (ly:music-property event 'name) 'NoteEvent)) - (ly:music-property new-chord 'elements)))) - (for-each (lambda (event) - (if (ly:duration? (ly:music-property event 'duration)) - (set! (ly:music-property event 'duration) duration))) - (ly:music-property new-chord 'elements)) - new-chord)) +chordRepeats = +#(define-music-function (event-types music) + ((list? '()) ly:music?) + "Walk through @var{music} putting the notes of the previous chord +into repeat chords, as well as an optional list of @var{event-types} +such as @code{#'(string-number-event)}." + (expand-repeat-chords! (cons 'rhythmic-event event-types) music)) + +tabChordRepeats = +#(define-music-function (event-types music) + ((list? '()) ly:music?) + "Walk through @var{music} putting the notes, fingerings and string +numbers of the previous chord into repeat chords, as well as an +optional list of @var{event-types} such as @code{#'(articulation-event)}." + #{ \chordRepeats + #(append '(string-number-event fingering-event) event-types) + #music + #}) -#(ly:parser-set-repetition-symbol parser 'q) -#(ly:parser-set-repetition-function parser default-repeat-chord) +tabChordRepetition = +#(define-void-function () () + (_i "Include the string and fingering information in a chord repetition. +This function is deprecated; try using @code{\\tabChordRepeats} instead.") + (ly:parser-define! '$chord-repeat-events + '(string-number-event fingering-event)))