From: Rune Zedeler Date: Sat, 28 Jul 2007 22:20:24 +0000 (+1000) Subject: Fix 386. X-Git-Tag: release/2.11.29-1~36 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=39e67517c7ea01fb4b728bf0c3235ed2e301f9b4;p=lilypond.git Fix 386. Fix dot and beam calculations for tremolos. --- diff --git a/input/regression/repeat-tremolo-beams.ly b/input/regression/repeat-tremolo-beams.ly new file mode 100644 index 0000000000..8ad418ee13 --- /dev/null +++ b/input/regression/repeat-tremolo-beams.ly @@ -0,0 +1,13 @@ +\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 diff --git a/input/regression/repeat-tremolo-dots.ly b/input/regression/repeat-tremolo-dots.ly new file mode 100644 index 0000000000..9fa8402e9d --- /dev/null +++ b/input/regression/repeat-tremolo-dots.ly @@ -0,0 +1,11 @@ +\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 diff --git a/lily/chord-tremolo-iterator.cc b/lily/chord-tremolo-iterator.cc index 05e56e24a5..71e206aa03 100644 --- a/lily/chord-tremolo-iterator.cc +++ b/lily/chord-tremolo-iterator.cc @@ -41,7 +41,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 928eaf7169..ce2286f3e2 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))))