]> 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 e6b8a97f58eaf45b88b1496a44bfb80428b8562f..ba8aa761644c75ddd0d009e2b77335cf88e61ebe 100644 (file)
@@ -346,6 +346,7 @@ footnoteGrob =
    (_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)
@@ -360,9 +361,14 @@ 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})")
-   #{
-     \footnoteGrob $grob-name $offset \markup { \null } $footnote
-   #})
+   (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)
@@ -370,14 +376,12 @@ footnote =
    (_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))
 
-% this function can't be a simple copy and past of the above because
-% it needs to be encapsulated in a Sequential Music.
-% so, there's a code dup of above :-(
 autoFootnote =
 #(define-music-function (parser location offset footnote)
    (number-pair? markup?)
@@ -387,6 +391,7 @@ 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)
@@ -512,7 +517,7 @@ makeClusters =
 
 modalInversion =
 #(define-music-function (parser location around to scale music)
-    (ly:music? ly:music? ly:music? ly: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)))
@@ -521,7 +526,7 @@ transpose from @var{around} to @var{to}.")
 
 modalTranspose =
 #(define-music-function (parser location from to scale music)
-    (ly:music? ly:music? ly:music? ly: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)))
@@ -530,7 +535,7 @@ using @var{scale}.")
 
 inversion =
 #(define-music-function
-   (parser location around to music) (ly:music? ly:music? ly:music?)
+   (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))
@@ -565,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?)
@@ -784,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
@@ -838,18 +855,12 @@ 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))
-
-     reference-note))
+   (make-music 'SequentialMusic
+               'to-relative-callback
+               (lambda (music last-pitch) pitch)))
 
 retrograde =
 #(define-music-function (parser location music)
@@ -870,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)
@@ -897,6 +903,13 @@ shiftDurations =
     (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
@@ -938,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.")
@@ -955,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 =