- if (i == 0)
- return false;
-
- // In fact, we don't need to check that the visible stem has more beams
- // than the invisible stem. unbeam_invisible_stems() ensures that the
- // visible stem has at least as many stems as the invisible stem, so
- // we only need to check that they are not equal.
- return infos_[i].invisible_ != infos_[i-1].invisible_
- && infos_[i].beam_count_drul_[LEFT] != infos_[i-1].beam_count_drul_[RIGHT];
-}
-
-/*
- Finds the best point at which to subdivide a beam. In order of priority
- (highest to lowest) this is
- - before or after an invisible beam
- - at the start of a beat group
- - at the start of a beat
- - whose position in its beat has the smallest denominator (that is,
- a stem that starts halfway through a beat will be preferred over stems
- that start 1/3 or 2/3s of the way through the beat).
- - any other beam
- - at the start of a beat group
- - at the start of a beat
- - whose position in its beat has the smallest denominator
-
- If the split point occurs at the start of a beat group or at the start of a
- beat, at_boundary will be set to true. Otherwise, it will be set to false.
-*/
-int
-Beaming_pattern::best_splitpoint_index (bool *at_boundary) const
-{
- bool require_invisible = false;
- for (vsize i = 0; i < infos_.size (); i++)
- require_invisible |= is_next_to_invisible_stem (i);
-
- *at_boundary = true;
- for (vsize i = 1; i < infos_.size (); i++)
+ // The extremal stems shouldn't be messed with, so it's appropriate to
+ // return CENTER here also.
+ if (i == 0 || i == infos_.size () - 1)
+ return CENTER;
+
+ int count = infos_[i].count (LEFT); // Both directions should still be the same
+ int left_count = infos_[i - 1].count (RIGHT);
+ int right_count = infos_[i + 1].count (LEFT);
+
+ // If we are told to subdivide beams and we are next to a beat, point the
+ // beamlet away from the beat.
+ if (options.subdivide_beams_)