From: Han-Wen Nienhuys Date: Sat, 17 Jun 2006 23:03:12 +0000 (+0000) Subject: * input/regression/beaming-ternary-metrum.ly: update doc. X-Git-Tag: cvs/HEAD~284 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8fb308fb4d685e4ac4860b425b5139542b91f977;p=lilypond.git * input/regression/beaming-ternary-metrum.ly: update doc. * scm/music-functions.scm (make-time-signature-set): add standard-beat-grouping. --- diff --git a/ChangeLog b/ChangeLog index c592213f4f..97729c4926 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-06-18 Han-Wen Nienhuys + + * input/regression/beaming-ternary-metrum.ly: update doc. + + * scm/music-functions.scm (make-time-signature-set): add + standard-beat-grouping. + 2006-06-17 Han-Wen Nienhuys * input/regression/tie-whole.ly: new file. diff --git a/input/regression/beaming-ternary-metrum.ly b/input/regression/beaming-ternary-metrum.ly index 0bc3df702d..50d071ef92 100644 --- a/input/regression/beaming-ternary-metrum.ly +++ b/input/regression/beaming-ternary-metrum.ly @@ -1,8 +1,14 @@ -\version "2.7.39" +\version "2.9.10" + \header { - texidoc = "Automatic beaming works also in ternary time sigs." + + texidoc = "Automatic beaming works also in ternary time sigs. In + this case, the 8th is a beat, so the 16ths are split into two + groups." + } + \layout { ragged-right = ##t} \relative c'' { diff --git a/lily/beaming-pattern.cc b/lily/beaming-pattern.cc index ca9970dd89..87ff00dc63 100644 --- a/lily/beaming-pattern.cc +++ b/lily/beaming-pattern.cc @@ -56,7 +56,7 @@ Beaming_pattern::best_splitpoint_index (bool *at_boundary) const *at_boundary = false; - int min_factor_twos = INT_MAX; + int min_den = INT_MAX; int min_index = -1; Moment beat_pos; @@ -72,11 +72,11 @@ Beaming_pattern::best_splitpoint_index (bool *at_boundary) const */ - int factor_2s = count_factor_twos (dt.den ()); + dt /= infos_[i].beat_length_; - if (factor_2s < min_factor_twos) + if (dt.den () < min_den) { - min_factor_twos = factor_2s; + min_den = dt.den (); min_index = i; } } @@ -142,7 +142,7 @@ Beaming_pattern::beamify (Context *context) j++; infos_[i].group_start_ = group_starts[j]; - + infos_[i].beat_length_ = beat_length; while (k < beat_starts.size() - 1 && beat_starts[k+1] <= infos_[i].start_moment_) k++; diff --git a/lily/include/beaming-pattern.hh b/lily/include/beaming-pattern.hh index 9f2adb1940..6033217668 100644 --- a/lily/include/beaming-pattern.hh +++ b/lily/include/beaming-pattern.hh @@ -19,6 +19,7 @@ struct Beam_rhythmic_element Drul_array beam_count_drul_; Moment beat_start_; + Moment beat_length_; Moment group_start_; Beam_rhythmic_element (Moment, int); diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 89d640be12..e33e1629af 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -474,6 +474,23 @@ OTTAVATION to `8va', or whatever appropriate." (define-public (make-time-signature-set num den . rest) "Set properties for time signature NUM/DEN. Rest can contain a list of beat groupings " + + (define (standard-beat-grouping num den) + + "Some standard subdivisions for time signatures." + (let* + ((key (cons num den)) + (entry (assoc key '(((6 . 8) . (3 3)) + ((5 . 8) . (3 2)) + ((9 . 8) . (3 3 3)) + ((12 . 8) . (3 3 3 3)) + ((8 . 8) . (3 3 2)) + )))) + + (if entry + (cdr entry) + '()))) + (let* ((set1 (make-property-set 'timeSignatureFraction (cons num den))) (beat (ly:make-moment 1 den)) (len (ly:make-moment num den)) @@ -481,7 +498,7 @@ of beat groupings " (set3 (make-property-set 'measureLength len)) (set4 (make-property-set 'beatGrouping (if (pair? rest) (car rest) - '()))) + (standard-beat-grouping num den)))) (basic (list set1 set2 set3 set4))) (descend-to-context (context-spec-music (make-sequential-music basic) 'Timing) 'Score)))