]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/music-functions-init.ly
Doc: use @dots{} rather than "..."
[lilypond.git] / ly / music-functions-init.ly
index 183bf4db21f79b5207be319967ef7d0f16e4ffd9..86a81c35989375ac19ea32fa71a0b342906b1257 100644 (file)
@@ -429,6 +429,26 @@ to the preceding note or rest as a post-event with @code{-}.")
               'footnote-text footnote)))
      #{ \tweak footnote-music #mus #item #}))
 
+free =
+#(define-music-function (parser location music) (ly:music?)
+  (_i "@var{event} should start a free spanner.")
+  (let ((name (ly:music-property music 'name)))
+    (cond
+      ((eq? name 'SlurEvent)
+       (make-music 'BreakSlurEvent
+                   'span-direction (ly:music-property music 'span-direction)
+                   'direction (ly:music-property music 'direction)
+                   'spanner-id (ly:music-property music 'spanner-id)))
+      ((eq? name 'PhrasingSlurEvent)
+       (make-music 'BreakPhrasingSlurEvent
+                   'span-direction (ly:music-property music 'span-direction)
+                   'direction (ly:music-property music 'direction)
+                   'spanner-id (ly:music-property music 'spanner-id)))
+      (else
+        (begin
+          (ly:music-warning music (_ "not a breakable event"))
+        music)))))
+
 grace =
 #(def-grace-function startGraceMusic stopGraceMusic
    (_i "Insert @var{music} as grace notes."))
@@ -1032,9 +1052,23 @@ usually contains spacers or multi-measure rests.")
 
 relative =
 #(define-music-function (parser location pitch music)
-   (ly:pitch? ly:music?)
-   (_i "Make @var{music} relative to @var{pitch}.")
-   (ly:make-music-relative! music pitch)
+   ((ly:pitch?) ly:music?)
+   (_i "Make @var{music} relative to @var{pitch}.  If @var{pitch} is
+omitted, the first note in @var{music} is given in absolute pitch.")
+   ;; When \relative has no clear decision (can only happen with
+   ;; scales with an even number of steps), it goes down (see
+   ;; pitch.cc).  The following formula puts out f for both the normal
+   ;; 7-step scale as well as for a "shortened" scale missing the
+   ;; final b.  In either case, a first note of c will end up as c,
+   ;; namely pitch (-1, 0, 0).
+   (ly:make-music-relative! music
+                            (or pitch
+                                (ly:make-pitch
+                                 -1
+                                 (quotient
+                                  ;; size of current scale:
+                                  (ly:pitch-steps (ly:make-pitch 1 0))
+                                  2))))
    (make-music 'RelativeOctaveMusic
               'element music))