]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/test/add-staccato.ly
Merge with git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond.git
[lilypond.git] / input / test / add-staccato.ly
index aeed619c72edd44c26b0464cb72305545d2f1213..aee898561d4f13f077d34f87337b390384aae8a8 100644 (file)
@@ -1,38 +1,36 @@
-\version "1.7.16"  %% or actually: 1.7.1 ...
-\header {
-
-texidoc= "Using make-music, you can add various stuff to notes. Here
-is an example how to add staccato dots.  Note: for this simple case
-one would not use scm constructs.  See separate-staccato.ly first."
+\version "2.10.0"
+\sourcefilename "add-staccato.ly"
 
+\header {
+texidoc= "@cindex Add Stacato
+Using @code{make-music}, you can add various stuff to notes. In this
+example staccato dots are added to the notes."
 } 
 
 #(define (make-script x)
-   (let ((m (make-music-by-name 'ArticulationEvent)))
-     (ly:set-mus-property! m 'articulation-type x)
-     m))
-    
-#(define (add-script m x)
-   (if (equal? (ly:get-mus-property m 'name) 'RequestChord)
-       (ly:set-mus-property! m 'elements
-                           (cons (make-script x)
-                                 (ly:get-mus-property m 'elements)))
+   (make-music 'ArticulationEvent
+               'articulation-type x))
 
-       (let ((es (ly:get-mus-property m 'elements))
-            (e (ly:get-mus-property m 'element)) )
-        (map (lambda (y) (add-script y x)) es)
-        (if (ly:music? e)
-            (add-script e x))))
+#(define (add-script m x)
+   (if
+     (equal? (ly:music-property m 'name) 'EventChord)
+     (set! (ly:music-property m 'elements)
+           (cons (make-script x)
+                 (ly:music-property m 'elements))))
    m)
 
 #(define (add-staccato m)
    (add-script m "staccato"))
 
+addStacc =
+#(define-music-function (parser location music) 
+                                       (ly:music?)
+               (music-map add-staccato music))    
+
 \score {
-  \notes\relative c'' {
-    a b \apply #add-staccato { c c } 
-    a b \apply #add-staccato { c c } 
+  \relative c'' {
+    a b \addStacc { c c } 
   }
+  \layout{ ragged-right = ##t }
 }
 
-%% new-chords-done %%