bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for bug 386 and untracked bug


From: Rune Zedeler
Subject: Patch for bug 386 and untracked bug
Date: Wed, 18 Jul 2007 01:34:18 +0200
User-agent: Thunderbird 1.5.0.12 (X11/20070604)

(whoops, sent to devel instead of bug. Resending)

It seems that the following bug has not made it to the tracker:

When repeat tremolo 3, one tremolo-beam is missing.
In this example, all staves should get 4 tremolo bars, but staves 2 and
4 only get 3 tremolo bars.

\version "2.10.25"
\paper { ragged-right = ##t }
<<
   \repeat tremolo 8 { c64 e64 }
   \repeat tremolo 12 { c64 e64 }
   \repeat tremolo 14 { c64 e64 }
   \repeat tremolo 15 { c64 e64 }
 >>



This patch fixes this as well as bug 386.

-Rune

diff --git a/lily/chord-tremolo-iterator.cc b/lily/chord-tremolo-iterator.cc
index 05e56e2..bc2d207 100644
--- a/lily/chord-tremolo-iterator.cc
+++ b/lily/chord-tremolo-iterator.cc
@@ -41,7 +42,7 @@ Chord_tremolo_iterator::get_music_list () const
   Rational note_dur = total_dur / Rational (elt_count * 
Repeated_music::repeat_count (mus));
 
   SCM tremolo_type = scm_int2num (note_dur.den ());
-  int expected_beaming_ = max (0, (intlog2 (total_dur.den ()) - 2));
+  int expected_beaming_ = max (0, (intlog2 (total_dur.den ()) - intlog2 
(total_dur.num () + 1) - 1));
 
   if (elt_count == 1)
     {
diff --git a/scm/music-functions.scm b/scm/music-functions.scm
index 928eaf7..ce2286f 100644
--- a/scm/music-functions.scm
+++ b/scm/music-functions.scm
@@ -233,13 +233,11 @@ Returns `obj'.
     (set! (ly:music-property r 'repeat-count) (max times 1))
     (set! (ly:music-property r 'elements) talts)
     (if (equal? name "tremolo")
-       (let* ((dot? (zero? (modulo times 3)))
-              (dots (if dot? 1 0))
-              (mult (if dot?
-                        (quotient (* times 2) 3)
-                        times))
-              (shift (- (ly:intlog2 mult))))
-         
+       (let* ((dots (1- (logcount times)))
+              (mult (/ (* times (ash 1 dots)) (1- (ash 2 dots))))
+              (shift (- (ly:intlog2 (floor mult)))))
+         (if (not (integer?  mult))
+              (ly:warning (_ "illegal tremolo repeat count: ~a") times))
          (if (memq 'sequential-music (ly:music-property main 'types))
              ;; \repeat "tremolo" { c4 d4 }
              (let ((children (length (ly:music-property main 'elements))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]