Hi Reinhold,

I've been looking at Haipeng's `Harmonious' score, and it's thrown up
a problem with single note tremolos when they're not sequential:

\repeat tremolo 4 c16

works fine, but

\repeat tremolo 4 c16\mf

results in an incorrectly scaled note, since `make-repeat' reads the
dynamic as the second child of the repeated music (the same happens
with other events encapsulated in the EventChord, such as
articulations).

I've added a patch which fixes this by setting the child-count
correctly.  Does it look OK?

Cheers,
Neil
From 1651046f900d47c5be6f3db47b3485bd07d3ec4e Mon Sep 17 00:00:00 2001
From: Neil Puttock <[email protected]>
Date: Tue, 13 Jul 2010 23:17:26 +0100
Subject: [PATCH] Fix bare stem tremolos.

* scm/music-functions.scm (make-repeat):

  don't use length of 'elements for non-sequential repeat tremolos
---
 scm/music-functions.scm |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/scm/music-functions.scm b/scm/music-functions.scm
index 9f173ff..ae02fb6 100644
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -265,9 +265,14 @@ through MUSIC."
     (set! (ly:music-property r 'element) main)
     (set! (ly:music-property r 'repeat-count) (max times 1))
     (set! (ly:music-property r 'elements) talts)
-    (if (and (equal? name "tremolo") (> (length (ly:music-property main 'elements)) 0))
+    (if (and (equal? name "tremolo")
+	     (pair? (ly:music-property main 'elements)))
 	;; This works for single-note and multi-note tremolos!
-	(let* ((children (length (ly:music-property main 'elements)))
+	(let* ((children (if (music-is-of-type? main 'sequential-music)
+			     ;; \repeat tremolo n { ... }
+			     (length (ly:music-property main 'elements))
+			     ;; \repeat tremolo n c4
+			     1))
 	       ;; # of dots is equal to the 1 in bitwise representation (minus 1)!
 	       (dots (1- (logcount (* times children))))
 	       ;; The remaining missing multiplicator to scale the notes by 
@@ -282,7 +287,6 @@ through MUSIC."
 	  (set! (ly:music-property r 'tremolo-type) tremolo-type)
 	  (if (not (integer?  mult))
               (ly:warning (_ "invalid tremolo repeat count: ~a") times))
-	  ;; \repeat tremolo n c4
 	  ;; Adjust the time of the notes
 	  (ly:music-compress r (ly:make-moment 1 children))
 	  ;; Adjust the displayed note durations
-- 
1.7.0.4

_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to