- {
- count = scm_to_int (scm_car (grouping));
- grouping = scm_cdr (grouping);
- }
-
- group_starts.push_back (measure_pos);
- for (int i = 0; i < count; i++)
- {
- beat_starts.push_back (measure_pos + beat_length * i);
- }
- measure_pos += beat_length * count;
+ {
+ count = scm_to_int (scm_car (grouping));
+ grouping = scm_cdr (grouping);
+ }
+
+ // Mark the start of this beat group
+ if (infos_[i].start_moment_ == measure_pos)
+ infos_[i].rhythmic_importance_ = -2;
+
+ // Mark the start of each unit up to the end of this beat group.
+ for (int unit = 1; unit <= count; unit++)
+ {
+ Moment next_measure_pos = measure_pos + options.base_moment_;
+
+ while (i < infos_.size () && infos_[i].start_moment_ < next_measure_pos)
+ {
+ Moment dt = infos_[i].start_moment_ - measure_pos;
+
+ // The rhythmic importance of a stem between beats depends on its fraction
+ // of a beat: those stems with a lower denominator are deemed more
+ // important.
+ // FIXME: This is not the right way to do things for tuplets. For example,
+ // in an 8th-note triplet with a quarter-note beat, 1/3 of a beat should be
+ // more important than 1/2.
+ if (infos_[i].rhythmic_importance_ >= 0)
+ infos_[i].rhythmic_importance_ = (int) (dt / options.base_moment_).den ();
+
+ i++;
+ }
+
+ measure_pos = next_measure_pos;
+ if (i < infos_.size () && infos_[i].start_moment_ == measure_pos)
+ infos_[i].rhythmic_importance_ = -1;
+ }