]> git.donarmstrong.com Git - lilypond.git/blobdiff - ly/articulate.ly
Release: bump version.
[lilypond.git] / ly / articulate.ly
index 5afb4adfe7d132e71b35b4bced2c03244ab1b709..59424e515216b95776e038dadf653566ab25b3cb 100644 (file)
@@ -78,6 +78,8 @@
 % * accidentals for trills and turns
 
 % CHANGELOG
+%  * David Kastrup: basic 2.15.28 compatibility by using event-chord-wrap!
+%    This should really be done by rewriting the code more thoroughly.
 %  * From Iain Nicol: appoggiatura timings were out; add staccatissimo; fix
 %    trillSpanner endpoints.
 %  * Also handle Breathing events (by throwing them away).  This isn't ideal;
@@ -87,7 +89,7 @@
 %  * Add Mordents (reported by Patrick Karl)
 %
 
-\version "2.13.58"
+\version "2.15.30"
 
 #(use-modules (ice-9 debug))
 #(use-modules (scm display-lily))
 
       ((BeamEvent) ; throw away beam events, or they'll be duplicated by turn or trill
        (loop factor newelements tail actions))
-      ((LineBreakEvent) ; pass through linebreak events.
-       (loop (cons 1 1) (cons e newelements) tail actions))
-      ((FingeringEvent) ; and fingering events too.
-       (loop factor newelements tail actions))
 
-      ((BreathingEvent) ; throw away BreathingEvent ---
-       ; should really shorten previous note a little.
-       (loop (cons 1 1) (cons e newelements) tail actions))
-
-      ((TieEvent)
-       (loop (cons 1 1) (cons e newelements) tail actions))
-
-      ((SkipEvent)
-       (loop (cons 1 1) (cons e newelements) tail actions))
-
-      ((RestEvent)
+      ((LineBreakEvent FingeringEvent MarkEvent BreathingEvent TieEvent SkipEvent RestEvent) ; pass through some events.
        (loop (cons 1 1) (cons e newelements) tail actions))
 
       ((ArticulationEvent)
         ((string= articname "mordent")
          (loop (cons 1 1) newelements tail (cons 'mordent actions)))
         ((string= articname "prall")
-         (loop (cons 1 1) newelements tail (cons 'trill actions)))
+         (loop (cons 1 1) newelements tail (cons 'prall actions)))
         ((string= articname "trill")
          (loop (cons 1 1) newelements tail (cons 'trill actions)))
         ((string= articname "turn")
        ((trill)
         (ac:trill music))
 
+       ((prall)
+       ; A pralltriller symbol can either mean an inverted mordent
+       ; or a half-shake -- a short, two twiddle trill.
+       ; We implement as a half-shake.
+       (let*
+        ((totallength (ly:music-length music))
+         (newlen (ly:moment-sub totallength (ly:make-moment 3 32)))
+         (newdur (ly:make-duration
+                  0 0
+                  (ly:moment-main-numerator newlen)
+                  (ly:moment-main-denominator newlen)))
+         (gracedur (ly:make-duration 5 0 1 1))
+         (gracenote (ly:music-deep-copy music))
+         (abovenote (ly:music-deep-copy music))
+         (mainnote (ly:music-deep-copy music))
+         (prall (make-sequential-music (list gracenote abovenote)))
+       )
+         (music-map (lambda (n)
+          (if (eq? 'NoteEvent (ly:music-property n 'name))
+            (set! (ly:music-property n 'duration) gracedur))
+                     n)
+          abovenote)
+         (music-map (lambda (n)
+          (if (eq? 'NoteEvent (ly:music-property n 'name))
+            (set! (ly:music-property n 'duration) gracedur))
+                     n)
+          gracenote)
+         (music-map (lambda (n)
+          (if (eq? 'NoteEvent (ly:music-property n 'name))
+            (set! (ly:music-property n 'duration) newdur))
+                     n)
+          mainnote)
+
+         (map (lambda (y) (ac:up y))
+          (filter
+           (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
+           (ly:music-property abovenote 'elements)))
+         (make-sequential-music (list abovenote gracenote abovenote mainnote))))
+
        ((mordent)
        (let*
-        ((dur (ly:music-property
+        ((totaldur (ly:music-property
                (car (ly:music-property music 'elements)) 'duration))
-         (factor (ly:duration-factor dur))
+         (dur (ly:duration-length totaldur))
+         (newlen (ly:moment-sub dur (ly:make-moment 2 32)))
+         (newdur (ly:make-duration
+               0 0
+                  (ly:moment-main-numerator newlen)
+                  (ly:moment-main-denominator newlen)))
          (gracenote (ly:music-deep-copy music))
-         (mainnote (ly:music-deep-copy music))
          (belownote (ly:music-deep-copy music))
+         (mainnote (ly:music-deep-copy music))
          (mordent (make-sequential-music (list gracenote belownote)))
-)
+       )
         (begin
          (music-map (lambda (n)
           (if (eq? 'NoteEvent (ly:music-property n 'name))
-           (set! (ly:music-property n 'duration)(ly:make-duration 3 0 1 1)))
+           (set! (ly:music-property n 'duration)
+            (ly:make-duration 5 0 1 1)))
                      n)
           mordent)
+         (music-map (lambda (n)
+          (if (eq? 'NoteEvent (ly:music-property n 'name))
+            (set! (ly:music-property n 'duration) newdur))
+                     n)
+          mainnote)
          (map (lambda (y) (ac:down y))
           (filter
            (lambda (z) (eq? 'NoteEvent (ly:music-property z 'name)))
            (ly:music-property belownote 'elements)))
-         (make-sequential-music (list (make-grace-music mordent) mainnote)))))
+         (make-sequential-music (list mordent mainnote)))))
        ((turn)
        (let*
         ((dur (ly:music-property
@@ -595,6 +633,7 @@ articulate = #(define-music-function (parser location music)
               "Adjust times of note to add tenuto, staccato and
                 normal articulations.
                "
+              (set! music (event-chord-wrap! music parser))
               (music-map ac:articulate-chord music)
               )
 
@@ -604,8 +643,10 @@ articulate = #(define-music-function (parser location music)
 afterGrace =
 #(define-music-function
   (parser location main grace)
-  (ly:music? ly:music?)p
+  (ly:music? ly:music?)
 
+  (set! main (event-chord-wrap! main parser))
+  (set! grace (event-chord-wrap! grace parser))
   (let*
    ((main-length (ly:music-length main))
     (grace-orig-length (ly:music-length grace))
@@ -630,6 +671,8 @@ afterGrace =
 appoggiatura =
 #(define-music-function (parser location grace main)
   (ly:music? ly:music?)
+  (set! grace (event-chord-wrap! grace parser))
+  (set! main (event-chord-wrap! main parser))
   (let* ((maindur (ly:music-length main))
         (grace-orig-len (ly:music-length grace))
         (main-orig-len (ly:music-length main))