]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/music-functions-init.ly
Docs: lilyquote -> quote snippet option
[lilypond.git] / ly / music-functions-init.ly
index fc49725f07d395cf4eec1832db6b9283a96f3a55..ba8aa761644c75ddd0d009e2b77335cf88e61ebe 100644 (file)
@@ -18,7 +18,7 @@
 %%%% You should have received a copy of the GNU General Public License
 %%%% along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
-\version "2.13.29"
+\version "2.14.0"
 
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -172,7 +172,7 @@ barNumberCheck =
               (lambda (c)
                 (let ((cbn (ly:context-property c 'currentBarNumber)))
                   (if (and  (number? cbn) (not (= cbn n)))
-                      (ly:input-message location
+                      (ly:input-warning location
                                         "Barcheck failed got ~a expect ~a"
                                         cbn n))))))
 
@@ -204,8 +204,6 @@ breathe =
    (_i "Insert a breath mark.")
    (make-music 'BreathingEvent))
 
-
-
 clef =
 #(define-music-function (parser location type) (string?)
    (_i "Set the current clef to @var{type}.")
@@ -214,14 +212,14 @@ clef =
 
 compoundMeter =
 #(define-music-function (parser location args) (pair?)
-  (_i "Create compound time signatures. The argument is a Scheme list of 
-lists. Each list describes one fraction, with the last entry being the 
-denominator, while the first entries describe the summands in the 
-enumerator. If the time signature consists of just one fraction, 
+  (_i "Create compound time signatures. The argument is a Scheme list of
+lists. Each list describes one fraction, with the last entry being the
+denominator, while the first entries describe the summands in the
+enumerator. If the time signature consists of just one fraction,
 the list can be given directly, i.e. not as a list containing a single list.
-For example, a time signature of (3+1)/8 + 2/4 would be created as 
-@code{\\compoundMeter #'((3 1 8) (2 4))}, and a time signature of (3+2)/8 
-as @code{\\compoundMeter #'((3 2 8))} or shorter 
+For example, a time signature of (3+1)/8 + 2/4 would be created as
+@code{\\compoundMeter #'((3 1 8) (2 4))}, and a time signature of (3+2)/8
+as @code{\\compoundMeter #'((3 2 8))} or shorter
 @code{\\compoundMeter #'(3 2 8)}.")
   (let* ((mlen (calculate-compound-measure-length args))
          (beat (calculate-compound-base-beat args))
@@ -342,7 +340,62 @@ featherDurations=
 
      argument))
 
+footnoteGrob =
+#(define-music-function (parser location grob-name offset text footnote)
+   (symbol? number-pair? markup? markup?)
+   (_i "Attach @var{text} to @var{grob-name} at offset @var{offset},
+with @var{text} referring to @var{footnote} (use like @code{\\once})")
+   (make-music 'FootnoteEvent
+               'automatically-numbered #f
+              'symbol grob-name
+              'X-offset (car offset)
+              'Y-offset (cdr offset)
+              'text text
+              'footnote-text footnote))
 
+autoFootnoteGrob =
+#(define-music-function (parser location grob-name offset footnote)
+   (symbol? number-pair? markup?)
+   (_i "Footnote @var{grob-name} with the text in @var{footnote}
+allowing for the footnote to be automatically numbered such that
+the number appears at @var{offset}.  Note that, for this to take effect,
+auto-numbering must be turned on in the paper block.  Otherwise, no
+number will appear.  Use like @code{\\once})")
+   (make-music 'FootnoteEvent
+               'automatically-numbered #t
+              'symbol grob-name
+              'X-offset (car offset)
+              'Y-offset (cdr offset)
+               'text (make-null-markup)
+              'footnote-text footnote))
+
+
+footnote =
+#(define-music-function (parser location offset text footnote)
+   (number-pair? markup? markup?)
+   (_i "Attach @var{text} at @var{offset} with @var{text} referring
+to @var{footnote} (use like @code{\\tweak})")
+   (make-music 'FootnoteEvent
+               'automatically-numbered #f
+              'X-offset (car offset)
+              'Y-offset (cdr offset)
+              'text text
+              'footnote-text footnote))
+
+autoFootnote =
+#(define-music-function (parser location offset footnote)
+   (number-pair? markup?)
+   (_i "Footnote the item after which this comes with the text in
+@var{footnote} allowing for the footnote to be automatically numbered
+such that the number appears at @var{offset}.  Note that, for this to
+take effect, auto-numbering must be turned on in the paper block.
+Otherwise, no number will appear.  Use like @code{\\tweak})")
+   (make-music 'FootnoteEvent
+               'automatically-numbered #t
+              'X-offset (car offset)
+              'Y-offset (cdr offset)
+              'text (make-null-markup)
+              'footnote-text footnote))
 
 grace =
 #(def-grace-function startGraceMusic stopGraceMusic
@@ -385,7 +438,7 @@ instrumentSwitch =
          (instrument-def (if handle (cdr handle) '())))
 
      (if (not handle)
-        (ly:input-message location "No such instrument: ~a" name))
+        (ly:input-warning location "No such instrument: ~a" name))
      (context-spec-music
       (make-music 'SimultaneousMusic
                  'elements
@@ -453,7 +506,7 @@ languageRestore =
        (begin
         (set! pitchnames previous-pitchnames)
         (ly:parser-set-note-names parser pitchnames))
-      (ly:warning (_ "No other language was defined previously. Ignoring.")))
+      (ly:input-warning location (_ "No other language was defined previously. Ignoring.")))
    (make-music 'Music 'void #t))
 
 
@@ -462,13 +515,36 @@ makeClusters =
    (_i "Display chords in @var{arg} as clusters.")
    (music-map note-to-cluster arg))
 
+modalInversion =
+#(define-music-function (parser location around to scale music)
+    (ly:pitch? ly:pitch? ly:music? ly:music?)
+    (_i "Invert @var{music} about @var{around} using @var{scale} and
+transpose from @var{around} to @var{to}.")
+    (let ((inverter (make-modal-inverter around to scale)))
+      (change-pitches music inverter)
+      music))
+
+modalTranspose =
+#(define-music-function (parser location from to scale music)
+    (ly:pitch? ly:pitch? ly:music? ly:music?)
+    (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}
+using @var{scale}.")
+    (let ((transposer (make-modal-transposer from to scale)))
+      (change-pitches music transposer)
+      music))
+
+inversion =
+#(define-music-function
+   (parser location around to music) (ly:pitch? ly:pitch? ly:music?)
+   (_i "Invert @var{music} about @var{around} and
+transpose from @var{around} to @var{to}.")
+   (music-invert around to music))
+
 musicMap =
 #(define-music-function (parser location proc mus) (procedure? ly:music?)
    (_i "Apply @var{proc} to @var{mus} and all of the music it contains.")
    (music-map proc mus))
 
-
-
 %% noPageBreak and noPageTurn are music functions (not music indentifiers),
 %% because music identifiers are not allowed at top-level.
 noPageBreak =
@@ -494,10 +570,10 @@ markups), or inside a score.")
 
 
 octaveCheck =
-#(define-music-function (parser location pitch-note) (ly:music?)
+#(define-music-function (parser location pitch) (ly:pitch?)
    (_i "Octave check.")
    (make-music 'RelativeOctaveCheck
-              'pitch (pitch-of-note pitch-note)))
+               'pitch pitch))
 
 ottava =
 #(define-music-function (parser location octave) (integer?)
@@ -654,7 +730,7 @@ Example:
                              (let ((moment-reference (ly:music-length (car seqs))))
                                (for-each (lambda (seq moment)
                                            (if (not (equal? moment moment-reference))
-                                               (ly:music-message seq
+                                               (ly:music-warning seq
                                                                  "Bars in parallel music don't have the same length")))
                                          seqs (map-in-order ly:music-length seqs))))
            voices)
@@ -713,6 +789,18 @@ partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
 partcombineAutomatic = \partcombineForce ##f ##f
 partcombineAutomaticOnce = \partcombineForce ##f ##t
 
+partial =
+#(define-music-function (parser location dur) (ly:duration?)
+  (_i "Make a partial measure.")
+
+  ;; We use `descend-to-context' here instead of `context-spec-music' to
+  ;; ensure \partial still works if the Timing_translator is moved
+    (descend-to-context
+     (context-spec-music (make-music 'PartialSet
+                                    'origin location
+                                    'partial-duration dur)
+                        'Timing)
+     'Score))
 
 pitchedTrill =
 #(define-music-function
@@ -737,7 +825,7 @@ print @var{secondary-note} as a stemless note head in parentheses.")
                  (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: "))
+                   (ly:input-warning location (_ "Second argument of \\pitchedTrill should be single note: "))
                    (display sec-note-events)))
 
              (if (eq? forced #t)
@@ -767,18 +855,18 @@ removeWithTag =
     music))
 
 resetRelativeOctave =
-#(define-music-function (parser location reference-note) (ly:music?)
+#(define-music-function (parser location pitch) (ly:pitch?)
    (_i "Set the octave inside a \\relative section.")
 
-   (let* ((notes (ly:music-property reference-note 'elements))
-         (pitch (ly:music-property (car notes) 'pitch)))
-
-     (set! (ly:music-property reference-note 'elements) '())
-     (set! (ly:music-property reference-note 'to-relative-callback)
-          (lambda (music last-pitch)
-            pitch))
+   (make-music 'SequentialMusic
+               'to-relative-callback
+               (lambda (music last-pitch) pitch)))
 
-     reference-note))
+retrograde =
+#(define-music-function (parser location music)
+    (ly:music?)
+    (_i "Return @var{music} in reverse order.")
+    (retrograde-music music))
 
 revertTimeSignatureSettings =
 #(define-music-function
@@ -793,16 +881,11 @@ rightHandFinger =
 #(define-music-function (parser location finger) (number-or-string?)
    (_i "Apply @var{finger} as a fingering indication.")
 
-   (apply make-music
-         (append
-          (list
-           'StrokeFingerEvent
-           'origin location)
-          (if  (string? finger)
-               (list 'text finger)
-               (list 'digit finger)))))
-
-
+   (make-music
+            'StrokeFingerEvent
+            'origin location
+            (if (string? finger) 'text 'digit)
+            finger))
 
 scaleDurations =
 #(define-music-function (parser location fraction music)
@@ -814,12 +897,24 @@ scaleDurations =
 shiftDurations =
 #(define-music-function (parser location dur dots arg)
    (integer? integer? ly:music?)
-   (_i "Scale @var{arg} up by a factor of @var{2^dur*(2-(1/2)^dots)}.")
+   (_i "Scale @var{arg} up by a factor of 2^@var{dur}*(2-(1/2)^@var{dots}).")
 
    (music-map
     (lambda (x)
       (shift-one-duration-log x dur dots)) arg))
 
+skip =
+#(define-music-function (parser location dur) (ly:duration?)
+  (_i "Skip forward by @var{dur}.")
+  (make-music 'SkipMusic
+             'duration dur))
+
+
+slashedGrace =
+#(def-grace-function startSlashedGraceMusic stopSlashedGraceMusic
+   (_i "Create slashed graces (slashes through stems, but no slur) from
+the following music expression"))
+
 spacingTweaks =
 #(define-music-function (parser location parameters) (list?)
    (_i "Set the system stretch, by reading the 'system-stretch property of
@@ -856,13 +951,22 @@ tag =
          (ly:music-property arg 'tags)))
    arg)
 
+transpose =
+#(define-music-function
+   (parser location from to music)
+   (ly:pitch? ly:pitch? ly:music?)
+
+   (_i "Transpose @var{music} from pitch @var{from} to pitch @var{to}.")
+   (make-music 'TransposedMusic
+               'element (ly:music-transpose music (ly:pitch-diff to from))))
+
 transposedCueDuring =
 #(define-music-function
-   (parser location what dir pitch-note main-music)
-   (string? ly:dir? ly:music? ly:music?)
+   (parser location what dir pitch main-music)
+   (string? ly:dir? ly:pitch? ly:music?)
 
    (_i "Insert notes from the part @var{what} into a voice called @code{cue},
-using the transposition defined by @var{pitch-note}.  This happens
+using the transposition defined by @var{pitch}.  This happens
 simultaneously with @var{main-music}, which is usually a rest. The
 argument @var{dir} determines whether the cue notes should be notated
 as a first or second voice.")
@@ -873,15 +977,15 @@ as a first or second voice.")
               'quoted-context-id "cue"
               'quoted-music-name what
               'quoted-voice-direction dir
-              'quoted-transposition (pitch-of-note pitch-note)))
+              'quoted-transposition pitch))
 
 transposition =
-#(define-music-function (parser location pitch-note) (ly:music?)
+#(define-music-function (parser location pitch) (ly:pitch?)
    (_i "Set instrument transposition")
 
    (context-spec-music
     (make-property-set 'instrumentTransposition
-                      (ly:pitch-negate (pitch-of-note pitch-note)))
+                       (ly:pitch-negate pitch))
     'Staff))
 
 tweak =
@@ -891,7 +995,7 @@ tweak =
 
    (if (equal? (object-property sym 'backend-type?) #f)
        (begin
-        (ly:warning (_ "cannot find property type-check for ~a") sym)
+        (ly:input-warning location (_ "cannot find property type-check for ~a") sym)
         (ly:warning (_ "doing assignment anyway"))))
    (set!
     (ly:music-property arg 'tweaks)