summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2006-06-17 23:03:12 +0000
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2006-06-17 23:03:12 +0000
commit79ee93bd2d973c23f0cea05e85d3b31b3d0766ba (patch)
treeda8c7d137e29b7feaeaa314a2d1fa1eee2083c9b
parentac73b9ae4bcfa0e596fe05ed804fc8c3b3abbe8d (diff)
* input/regression/beaming-ternary-metrum.ly: update doc.
* scm/music-functions.scm (make-time-signature-set): add standard-beat-grouping.
-rw-r--r--ChangeLog7
-rw-r--r--input/regression/beaming-ternary-metrum.ly10
-rw-r--r--lily/beaming-pattern.cc10
-rw-r--r--lily/include/beaming-pattern.hh1
-rw-r--r--scm/music-functions.scm19
5 files changed, 39 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index c592213f4f..97729c4926 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-18 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+ * 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 <hanwen@lilypond.org>
* 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<int> 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)))