Fix dot and beam calculations for tremolos.
--- /dev/null
+\version "2.10.25"
+
+\header {
+ texidoc = "Each of the staves here should have four tremolo beams."
+}
+
+\paper { ragged-right = ##t }
+<<
+ \repeat tremolo 8 { c64 e64 }
+ \repeat tremolo 12 { c64 e64 }
+ \repeat tremolo 14 { c64 e64 }
+ \repeat tremolo 15 { c64 e64 }
+>>
\ No newline at end of file
--- /dev/null
+\version "2.10.0"
+
+\header {
+ texidoc = "Dots are added to tremolo notes if the durations involved require them."
+}
+
+\paper{ ragged-right = ##t }
+\score { \relative c' {
+ c8 \repeat "tremolo" 14 { c32 a32 } |
+ }
+}
\ No newline at end of file
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)
{
(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))))