]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/music-functions-init.ly
Doc: NR - input.itely - TOC customization
[lilypond.git] / ly / music-functions-init.ly
index 54590a4cdde8e9549ada4554d21a703fb716d2fa..5c6fb24e6ed04e773d5f41bc22d40d0a6c13b046 100644 (file)
@@ -29,8 +29,6 @@
 #(use-modules (srfi srfi-1)
               (ice-9 optargs))
 
-%% TODO: using define-music-function in a .scm causes crash.
-
 absolute =
 #(define-music-function (music)
    (ly:music?)
@@ -189,19 +187,17 @@ pitch where to switch staves may be specified.  The clefs for the staves are
 optional as well.  Setting clefs  works only for implicitly instantiated
 staves.")
   (let ;; keep the contexts alive for the full duration
-       ((skip (make-skip-music (make-duration-of-length
-                                     (ly:music-length music)))))
-    #{
-      <<
-        \context Staff = "up" $(or clef-1 #{ \with { \clef "treble" } #})
-          <<
-          #(make-autochange-music pitch music)
-          \new Voice { #skip }
-          >>
-        \context Staff = "down" $(or clef-2 #{ \with { \clef "bass" } #})
-          \new Voice { #skip }
-      >>
-    #}))
+       ((skip (make-duration-of-length (ly:music-length music)))
+        (clef-1 (or clef-1 #{ \with { \clef "treble" } #}))
+        (clef-2 (or clef-2 #{ \with { \clef "bass" } #})))
+    (make-simultaneous-music
+     (list
+      (descend-to-context (make-autochange-music pitch music) 'Staff
+                          "up" clef-1)
+      (context-spec-music (make-skip-music skip) 'Staff
+                          "up" clef-1)
+      (context-spec-music (make-skip-music skip) 'Staff
+                          "down" clef-2)))))
 
 balloonGrobText =
 #(define-music-function (grob-name offset text)
@@ -1079,9 +1075,9 @@ Example:
     d d | e e | f f |
   }
 <==>
-  A = { c c | d d }
-  B = { d d | e e }
-  C = { e e | f f }
+  A = { c c | d d }
+  B = { d d | e e }
+  C = { e e | f f }
 @end verbatim
 
 The last bar checks in a sequence are not copied to the result in
@@ -1298,25 +1294,7 @@ that they share a staff with stems directed downward.")
     #{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #}
     #{ \with { \voiceTwo \override DynamicLineSpanner.direction = #DOWN } #} ))
 
-partcombineForce =
-#(define-music-function (type once) (boolean-or-symbol? boolean?)
-   (_i "Override the part-combiner.")
-   (make-music 'EventChord
-               'elements (list (make-music 'PartCombineForceEvent
-                                           'forced-type type
-                                           'once once))))
-partcombineApart = \partcombineForce #'apart ##f
-partcombineApartOnce = \partcombineForce #'apart ##t
-partcombineChords = \partcombineForce #'chords ##f
-partcombineChordsOnce = \partcombineForce #'chords ##t
-partcombineUnisono = \partcombineForce #'unisono ##f
-partcombineUnisonoOnce = \partcombineForce #'unisono ##t
-partcombineSoloI = \partcombineForce #'solo1 ##f
-partcombineSoloIOnce = \partcombineForce #'solo1 ##t
-partcombineSoloII = \partcombineForce #'solo2 ##f
-partcombineSoloIIOnce = \partcombineForce #'solo2 ##t
-partcombineAutomatic = \partcombineForce ##f ##f
-partcombineAutomaticOnce = \partcombineForce ##f ##t
+%% Part combine forcing to be found in ly/property-init.ly
 
 partial =
 #(define-music-function (dur) (ly:duration?)
@@ -1620,15 +1598,11 @@ control-point.  If @var{item} is a string, the result is
 @code{\\once\\override} for the specified grob type.  If @var{item} is
 a music expression, the result is the same music expression with an
 appropriate tweak applied.")
-   (define (shape-curve grob)
+   (define (shape-curve grob coords)
      (let* ((orig (ly:grob-original grob))
             (siblings (if (ly:spanner? grob)
                           (ly:spanner-broken-into orig) '()))
-            (total-found (length siblings))
-            (function (assoc-get 'control-points
-                                 (reverse (ly:grob-basic-properties grob))))
-            (coords (function grob)))
-
+            (total-found (length siblings)))
        (define (offset-control-points offsets)
          (if (null? offsets)
              coords
@@ -1651,7 +1625,9 @@ appropriate tweak applied.")
        (if (>= total-found 2)
            (helper siblings offsets)
            (offset-control-points (car offsets)))))
-   (once (propertyTweak 'control-points shape-curve item)))
+   (once (propertyTweak 'control-points
+                        (grob-transformer 'control-points shape-curve)
+                        item)))
 
 shiftDurations =
 #(define-music-function (dur dots arg)