X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fmusic-functions-init.ly;h=e4fe249d3343b66c15355993b158649182a19f9d;hb=dbad9a5ad3430ec0d7832f8854eb8cbb8195a6d8;hp=7bec31990ee298fab46fd25cf24470d1f9618f2f;hpb=1efdabf3b2349ea7fa3183dca5bba5104c347c36;p=lilypond.git diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly index 7bec31990e..e4fe249d33 100644 --- a/ly/music-functions-init.ly +++ b/ly/music-functions-init.ly @@ -1,3 +1,21 @@ +%%%% This file is part of LilyPond, the GNU music typesetter. +%%%% +%%%% Copyright (C) 2003--2009 Han-Wen Nienhuys +%%%% Jan Nieuwenhuizen +%%%% +%%%% 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 . + % -*-Scheme-*- \version "2.12.0" @@ -130,7 +148,7 @@ balloonGrobText = #(define-music-function (parser location grob-name offset text) (symbol? number-pair? markup?) (_i "Attach @var{text} to @var{grob-name} at offset @var{offset} -(use like @code{\\once})") +use like @code{\\once})") (make-music 'AnnotateOutputEvent 'symbol grob-name 'X-offset (car offset) @@ -169,7 +187,20 @@ bendAfter = #(define-music-function (parser location delta) (real?) (_i "Create a fall or doit of pitch interval @var{delta}.") (make-music 'BendAfterEvent - 'delta-step delta)) + 'delta-step delta)) + +bookOutputName = +#(define-music-function (parser location newfilename) (string?) + (_i "Direct output for the current book block to @var{newfilename}.") + (set! book-filename newfilename) + (make-music 'SequentialMusic 'void #t)) + +bookOutputSuffix = +#(define-music-function (parser location newsuffix) (string?) + (_i "Set the output filename suffix for the current book block to +@var{newsuffix}.") + (set! book-output-suffix newsuffix) + (make-music 'SequentialMusic 'void #t)) %% why a function? breathe = @@ -278,23 +309,6 @@ grace = -%% see comment for page-layout-parser definition below. -includePageLayoutFile = -#(define-music-function (parser location) () - (_i "Include the file @var{-page-layout.ly}. Deprecated as -part of two-pass spacing.") - (if (not (ly:get-option 'dump-tweaks)) - (let ((tweak-filename (format #f "~a-page-layout.ly" - (ly:parser-output-name parser)))) - (if (access? tweak-filename R_OK) - (begin - (ly:message "Including tweak file ~a" tweak-filename) - (set! page-layout-parser (ly:parser-clone parser)) - (ly:parser-parse-string page-layout-parser - (format #f "\\include \"~a\"" - tweak-filename)))))) - (make-music 'SequentialMusic 'void #t)) - instrumentSwitch = #(define-music-function (parser location name) (string?) @@ -306,7 +320,7 @@ instrumentSwitch = ) (if (not handle) - (ly:input-message "No such instrument: ~a" name)) + (ly:input-message location "No such instrument: ~a" name)) (context-spec-music (make-music 'SimultaneousMusic 'elements @@ -339,7 +353,8 @@ killCues = (_i "Remove cue notes from @var{music}.") (music-map (lambda (mus) - (if (string? (ly:music-property mus 'quoted-music-name)) + (if (and (string? (ly:music-property mus 'quoted-music-name)) + (string=? (ly:music-property mus 'quoted-context-id "") "cue")) (ly:music-property mus 'element) mus)) music)) @@ -461,15 +476,11 @@ or @code{\"GrobName\"}") -%% Parser used to read page-layout file (see includePageLayoutFile -%% above), and then retreive score tweaks (see scoreTweak below). -#(define page-layout-parser #f) - %% pageBreak and pageTurn are music functions (iso music indentifiers), %% because music identifiers are not allowed at top-level. pageBreak = #(define-music-function (location parser) () - (_i "Force a page break. May be used at toplevel (ie between scores or + (_i "Force a page break. May be used at toplevel (i.e. between scores or markups), or inside a score.") (make-music 'EventChord 'page-marker #t @@ -604,52 +615,54 @@ parenthesize = partcombine = #(define-music-function (parser location part1 part2) (ly:music? ly:music?) - (make-part-combine-music parser - (list part1 part2))) + (_i "Take the music in @var{part1} and @var{part2} and typeset so that they share a staff.") + (make-part-combine-music parser + (list part1 part2))) pitchedTrill = #(define-music-function (parser location main-note secondary-note) (ly:music? ly:music?) - (let* - ((get-notes (lambda (ev-chord) - (filter - (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) - (ly:music-property ev-chord 'elements)))) - (sec-note-events (get-notes secondary-note)) - (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event)) - (ly:music-property main-note 'elements)))) + (_i "Print a trill with @var{main-note} as the main note of the trill and +print @var{secondary-note} as a stemless note head in parentheses.") + (let* ((get-notes (lambda (ev-chord) + (filter + (lambda (m) (eq? 'NoteEvent (ly:music-property m 'name))) + (ly:music-property ev-chord 'elements)))) + (sec-note-events (get-notes secondary-note)) + (trill-events (filter (lambda (m) (music-has-type m 'trill-span-event)) + (ly:music-property main-note 'elements)))) (if (pair? sec-note-events) - (begin - (let* - ((trill-pitch (ly:music-property (car sec-note-events) 'pitch)) - (forced (ly:music-property (car sec-note-events ) 'force-accidental))) - - (if (ly:pitch? trill-pitch) - (for-each (lambda (m) (ly:music-set-property! m 'pitch trill-pitch)) - trill-events) - (begin - (ly:warning (_ "Second argument of \\pitchedTrill should be single note: ")) - (display sec-note-events))) - - (if (eq? forced #t) - (for-each (lambda (m) (ly:music-set-property! m 'force-accidental forced)) - trill-events))))) + (begin + (let* ((trill-pitch (ly:music-property (car sec-note-events) 'pitch)) + (forced (ly:music-property (car sec-note-events) 'force-accidental))) + + (if (ly:pitch? trill-pitch) + (for-each (lambda (m) + (ly:music-set-property! m 'pitch trill-pitch)) trill-events) + (begin + (ly:warning (_ "Second argument of \\pitchedTrill should be single note: ")) + (display sec-note-events))) + + (if (eq? forced #t) + (for-each (lambda (m) + (ly:music-set-property! m 'force-accidental forced)) + trill-events))))) main-note)) - - quoteDuring = #(define-music-function - (parser location what main-music) - (string? ly:music?) - (make-music 'QuoteMusic - 'element main-music - 'quoted-music-name what - 'origin location)) - - + (parser location what main-music) + (string? ly:music?) + (_i "Indicate a section of music to be quoted. @var{what} indicates the name +of the quoted voice, as specified in an @code{\\addQuote} command. +@var{main-music} is used to indicate the length of music to be quoted; +usually contains spacers or multi-measure rests.") + (make-music 'QuoteMusic + 'element main-music + 'quoted-music-name what + 'origin location)) removeWithTag = #(define-music-function @@ -715,18 +728,6 @@ scaleDurations = (ly:music-compress music (ly:make-moment (car fraction) (cdr fraction)))) -%% see comment for page-layout-parser definition above. -scoreTweak = -#(define-music-function (parser location name) (string?) - (_i "Include the score tweak, if exists.") - (if (and page-layout-parser (not (ly:get-option 'dump-tweaks))) - (let ((tweak-music (ly:parser-lookup page-layout-parser - (string->symbol name)))) - (if (ly:music? tweak-music) - tweak-music - (make-music 'SequentialMusic))) - (make-music 'SequentialMusic))) - setBeatGrouping = #(define-music-function (parser location grouping) (pair?) (_i "Set the beat grouping in the current time signature to @@ -835,7 +836,10 @@ tweak = unfoldRepeats = #(define-music-function (parser location music) (ly:music?) - (unfold-repeats music)) + (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or +@code{\\repeat percent} commands in @var{music} to be interpreted +as @code{\\repeat unfold}.") + (unfold-repeats music))