Pass Beaming_options to Beaming_pattern::beamify () iso. Context
pointer.
--- /dev/null
+
+\header {
+
+
+ texidoc = "Autobeamer remembers @code{subdivideBeams} and other
+beaming pattern related functions at the start of an autobeam."
+
+}
+
+
+\version "2.11.12"
+\paper { ragged-right = ##t }
+{
+ \time 2/4
+ b16 b b b
+ b16 b b b
+ \set subdivideBeams = ##t
+ \set Score.beatLength = #(ly:make-moment 1 8)
+ b16 b b b
+ b16 b b b
+}
Moment beam_start_moment_;
Moment beam_start_location_;
Moment beam_start_moment_;
Moment beam_start_location_;
- bool subdivide_beams_;
- Moment beat_length_;
-
// We act as if beam were created, and start a grouping anyway.
Beaming_pattern *grouping_;
SCM beam_settings_;
Beaming_pattern *finished_grouping_;
// We act as if beam were created, and start a grouping anyway.
Beaming_pattern *grouping_;
SCM beam_settings_;
Beaming_pattern *finished_grouping_;
+
+ Beaming_options beaming_options_;
+ Beaming_options finished_beaming_options_;
+
+
void check_bar_property ();
};
void check_bar_property ();
};
stems_ = new vector<Item*>;
grouping_ = new Beaming_pattern ();
stems_ = new vector<Item*>;
grouping_ = new Beaming_pattern ();
+ beaming_options_.from_context (context ());
beam_settings_ = updated_grob_properties (context (), ly_symbol2scm ("Beam"));
beam_start_moment_ = now_mom ();
beam_settings_ = updated_grob_properties (context (), ly_symbol2scm ("Beam"));
beam_start_moment_ = now_mom ();
{
announce_end_grob (finished_beam_, SCM_EOL);
finished_grouping_ = grouping_;
{
announce_end_grob (finished_beam_, SCM_EOL);
finished_grouping_ = grouping_;
+ finished_beaming_options_ = beaming_options_;
}
delete stems_;
stems_ = 0;
}
delete stems_;
stems_ = 0;
if (!finished_beam_->get_bound (RIGHT))
finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
if (!finished_beam_->get_bound (RIGHT))
finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
- finished_grouping_->beamify (context ());
+ finished_grouping_->beamify (finished_beaming_options_);
Beam::set_beaming (finished_beam_, finished_grouping_);
finished_beam_ = 0;
Beam::set_beaming (finished_beam_, finished_grouping_);
finished_beam_ = 0;
/// moment (global time) where beam started.
Moment beam_start_mom_;
/// moment (global time) where beam started.
Moment beam_start_mom_;
- bool subdivide_beams_;
- Moment beat_length_;
-
+ Beaming_options beaming_options_;
+ Beaming_options finished_beaming_options_;
+
void typeset_beam ();
void set_melisma (bool);
void typeset_beam ();
void set_melisma (bool);
beam_start_location_ = mp;
beam_start_mom_ = now_mom ();
beam_start_location_ = mp;
beam_start_mom_ = now_mom ();
+ beaming_options_.from_context (context ());
beam_info_ = new Beaming_pattern;
/* urg, must copy to Auto_beam_engraver too */
}
typeset_beam ();
if (stop_ev_ && beam_)
beam_info_ = new Beaming_pattern;
/* urg, must copy to Auto_beam_engraver too */
}
typeset_beam ();
if (stop_ev_ && beam_)
- announce_end_grob (beam_, stop_ev_->self_scm ());
+ {
+ announce_end_grob (beam_, stop_ev_->self_scm ());
+
+ }
{
if (!finished_beam_->get_bound (RIGHT))
finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
{
if (!finished_beam_->get_bound (RIGHT))
finished_beam_->set_bound (RIGHT, finished_beam_->get_bound (LEFT));
-
- finished_beam_info_->beamify (context ());
+
+ finished_beam_info_->beamify (finished_beaming_options_);
Beam::set_beaming (finished_beam_, finished_beam_info_);
delete finished_beam_info_;
Beam::set_beaming (finished_beam_, finished_beam_info_);
delete finished_beam_info_;
{
finished_beam_ = beam_;
finished_beam_info_ = beam_info_;
{
finished_beam_ = beam_;
finished_beam_info_ = beam_info_;
+ finished_beaming_options_ = beaming_options_;
+
stop_ev_ = 0;
beam_ = 0;
beam_info_ = 0;
stop_ev_ = 0;
beam_ = 0;
beam_info_ = 0;
-Beaming_pattern::beamify (Context *context)
+Beaming_pattern::beamify (Beaming_options const &options)
{
if (infos_.size () <= 1)
return;
if (infos_[0].start_moment_.grace_part_)
de_grace ();
{
if (infos_.size () <= 1)
return;
if (infos_[0].start_moment_.grace_part_)
de_grace ();
-
- bool subdivide_beams = to_boolean (context->get_property ("subdivideBeams"));
- Moment beat_length = robust_scm2moment (context->get_property ("beatLength"), Moment (1, 4));
- Moment measure_length = robust_scm2moment (context->get_property ("measureLength"), Moment (1, 4));
if (infos_[0].start_moment_ < Moment (0))
for (vsize i = 0; i < infos_.size(); i++)
if (infos_[0].start_moment_ < Moment (0))
for (vsize i = 0; i < infos_.size(); i++)
- infos_[i].start_moment_ += measure_length;
+ infos_[i].start_moment_ += options.measure_length_;
- SCM grouping = context->get_property ("beatGrouping");
Moment measure_pos (0);
vector<Moment> group_starts;
vector<Moment> beat_starts;
Moment measure_pos (0);
vector<Moment> group_starts;
vector<Moment> beat_starts;
+
+ SCM grouping = options.grouping_;
while (measure_pos <= infos_.back().start_moment_)
{
int count = 2;
while (measure_pos <= infos_.back().start_moment_)
{
int count = 2;
group_starts.push_back (measure_pos);
for (int i = 0; i < count; i++)
{
group_starts.push_back (measure_pos);
for (int i = 0; i < count; i++)
{
- beat_starts.push_back (measure_pos + beat_length * i);
+ beat_starts.push_back (measure_pos + options.beat_length_ * i);
- measure_pos += beat_length * count;
+ measure_pos += options.beat_length_ * count;
if (j < group_starts.size ())
infos_[i].group_start_ = group_starts[j];
if (j < group_starts.size ())
infos_[i].group_start_ = group_starts[j];
- infos_[i].beat_length_ = beat_length;
+ infos_[i].beat_length_ = options.beat_length_;
while (k + 1 < beat_starts.size()
&& beat_starts[k+1] <= infos_[i].start_moment_)
k++;
while (k + 1 < beat_starts.size()
&& beat_starts[k+1] <= infos_[i].start_moment_)
k++;
infos_[i].beat_start_ = beat_starts[k];
}
infos_[i].beat_start_ = beat_starts[k];
}
- beamify (subdivide_beams);
+ beamify (options.subdivide_beams_);
{
return infos_.at (i).beam_count_drul_[d];
}
{
return infos_.at (i).beam_count_drul_[d];
}
+
+void
+Beaming_options::from_context (Context *context)
+{
+ grouping_ = context->get_property ("beatGrouping");
+ subdivide_beams_ = to_boolean (context->get_property ("subdivideBeams"));
+ beat_length_ = robust_scm2moment (context->get_property ("beatLength"), Moment (1, 4));
+ measure_length_ = robust_scm2moment (context->get_property ("measureLength"), Moment (1, 4));
+}
+
+Beaming_options::Beaming_options ()
+{
+ grouping_ = SCM_EOL;
+ subdivide_beams_ = false;
+}
#include "moment.hh"
#include "lily-proto.hh"
#include "moment.hh"
#include "lily-proto.hh"
+struct Beaming_options
+{
+ SCM grouping_;
+ bool subdivide_beams_;
+ Moment beat_length_;
+ Moment measure_length_;
+
+ Beaming_options ();
+ void from_context (Context*);
+};
+
struct Beam_rhythmic_element
{
Moment start_moment_;
struct Beam_rhythmic_element
{
Moment start_moment_;
public:
Beaming_pattern ();
public:
Beaming_pattern ();
- void beamify (Context*);
+ void beamify (Beaming_options const&);
void de_grace ();
void add_stem (Moment d, int beams);
int beamlet_count (int idx, Direction d) const;
void de_grace ();
void add_stem (Moment d, int beams);
int beamlet_count (int idx, Direction d) const;