]> git.donarmstrong.com Git - lilypond.git/blobdiff - input/test/add-staccato.ly
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / input / test / add-staccato.ly
index bbf30f6feff69048fda8a3c007ec746b044f9aa7..3a8668c5b8e84da1c030105f0a69fbcf0ac8b6c3 100644 (file)
@@ -1,37 +1,33 @@
-\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.7.39"
+
+\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 (ly-make-music "Articulation_req")))
-     (ly-set-mus-property! m 'articulation-type x)
-     (ly-set-mus-property! m 'script x)
-     m))
+   (make-music 'ArticulationEvent
+               'articulation-type x))
     
 #(define (add-script m x)
-   (if (equal? (ly-music-name m) "Request_chord")
-       (ly-set-mus-property! m 'elements
-                           (cons (make-script x)
-                                 (ly-get-mus-property m 'elements)))
-
-       (let ((es (ly-get-mus-property m 'elements))
-            (e (ly-get-mus-property m 'element)) )
-        (map (lambda (y) (add-script y x)) es)
-        (if (music? e)
-            (add-script e 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"))
 
 \score {
-  \notes\relative c'' {
-    a b \apply #add-staccato { c c } 
-    a b \apply #add-staccato { c c } 
+  \relative c'' {
+    a b \applyMusic #(lambda (x) (music-map add-staccato x)) { c c } 
   }
+  \layout{ ragged-right = ##t }
 }
 
+