2003-09-21 Jan Nieuwenhuizen <janneke@gnu.org>
+ * lily/beam.cc (brew_molecule): read gap-count to determine
+ number of tremolo (gapped) beams.
+
+ * lily/chord-tremolo-engraver.cc (acknowledge_grob): repeats
+ shorter than 1/8
+
+ * flower/include/array.hh (default_compare): new function
+
* cygwin/mknetrel: Native fixes.
* cygwin/GNUmakefile (EXTRA_DIST_FILES): Add mknetrel.*
Real last_width = -1 ;
- SCM gap = me->get_grob_property ("gap");
+ Real gap_length =0.0;
+ SCM scm_gap = me->get_grob_property ("gap");
+ if (gh_number_p (scm_gap))
+ gap_length = gh_scm2double (scm_gap);
+
Molecule the_beam;
Real lt = me->get_paper ()->get_realvar (ly_symbol2scm ("linethickness"));
SCM this_beaming = st ? st->get_grob_property ("beaming") : SCM_EOL;
Real xposn = st ? st->relative_coordinate (xcommon, X_AXIS) : 0.0;
Real stem_width = st ? gh_scm2double (st->get_grob_property ("thickness")) *lt : 0 ;
-
+ Direction stem_dir = st ? to_dir (st->get_grob_property ("direction")) : CENTER;
/*
We do the space left of ST, with lfliebertjes pointing to the
right from the left stem, and rfliebertjes pointing left from
SCM left = (i>0) ? gh_cdr (last_beaming) : SCM_EOL;
SCM right = st ? gh_car (this_beaming) : SCM_EOL;
- Array<int> fullbeams;
+ Array<int> full_beams;
Array<int> lfliebertjes;
Array<int> rfliebertjes;
int b = gh_scm2int (gh_car (s));
if (scm_memq (gh_car(s), right) != SCM_BOOL_F)
{
- fullbeams.push (b);
+ full_beams.push (b);
}
else
{
width_corr += stem_width/2;
}
- if (gh_number_p (gap))
- {
- Real g = gh_scm2double (gap);
- stem_offset += g;
- width_corr -= 2*g;
- }
Molecule whole = Lookup::beam (dydx, w + width_corr, thick);
- for (int j = fullbeams.size(); j--;)
+ Molecule gapped;
+
+ int gap_count = 0;
+ if (gh_number_p (me->get_grob_property ("gap-count")))
+ {
+ gap_count = gh_scm2int (me->get_grob_property ("gap-count"));
+ gapped = Lookup::beam (dydx, w + width_corr - 2 * gap_length, thick);
+
+ full_beams.sort (default_compare);
+ if (stem_dir == UP)
+ full_beams.reverse ();
+ }
+
+ int k = 0;
+ for (int j = full_beams.size (); j--;)
{
Molecule b (whole);
+
+ if (k++ < gap_count)
+ {
+ b = gapped;
+ b.translate_axis (gap_length, X_AXIS);
+ }
b.translate_axis (last_xposn - x0 + stem_offset, X_AXIS);
- b.translate_axis (dydx * (last_xposn - x0) + bdy * fullbeams[j], Y_AXIS);
+ b.translate_axis (dydx * (last_xposn - x0) + bdy * full_beams[j], Y_AXIS);
+
the_beam.add_molecule (b);
}
+
+
if (lfliebertjes.size() || rfliebertjes.size())
{
Real nw_f;
Moment start_mom_;
Moment stop_mom_;
int flags_ ;
+ int total_duration_flags_;
+
/// location within measure where beam started.
Moment beam_start_location_;
Rational total_dur = l.main_part_;
Rational note_dur = total_dur / Rational (elt_count * repeat_->repeat_count ());
- if (total_dur < Rational (1,4))
- {
- /*
- This would require beams between flagged (8th) notes.
- */
- rp->origin ()->warning ("Chord tremolo is too short to denote properly.");
- }
+ total_duration_flags_ = 0 >? (intlog2 (total_dur.den ()) - 2);
flags_ = intlog2 (note_dur.den ()) -2 ;
else
Stem::set_beaming (s, flags_, LEFT);
- SCM d = s->get_grob_property ("direction");
if (Stem::duration_log (s) != 1)
{
- beam_->set_grob_property ("gap", gh_double2scm (0.8));
+ beam_->set_grob_property ("gap-count", gh_int2scm (flags_ - total_duration_flags_));
}
- s->set_grob_property ("direction", d);
if (info.music_cause ()->is_mus_type ("rhythmic-event"))
{