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
2003-09-21 Jan Nieuwenhuizen <janneke@gnu.org>
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.*
* cygwin/mknetrel: Native fixes.
* cygwin/GNUmakefile (EXTRA_DIST_FILES): Add mknetrel.*
+template<class T>
+int default_compare (T const&a , T const&b)
+{
+ if (a < b)
+ return -1;
+ else if (a > b)
+ return 1;
+ else
+ return 0;
+}
+
#include "array.icc"
#endif
#include "array.icc"
#endif
--- /dev/null
+\version "1.9.8"
+\header {
+ texidoc = "
+ Tremolo repeats can be constructed for short tremolos (total duration smaller than 1/8) too. Only some of the beams are connected to the stems.
+ "
+}
+
+\score {
+ \context Staff \notes \relative c' {
+ \repeat "tremolo" 2 { c32 e32 }
+ \stemDown
+ \repeat "tremolo" 2 { c32 e32 }
+ }
+ \paper { raggedright = ##t }
+}
+
+%% new-chords-done %%
+
- 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"));
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 ;
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
/*
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;
SCM left = (i>0) ? gh_cdr (last_beaming) : SCM_EOL;
SCM right = st ? gh_car (this_beaming) : SCM_EOL;
Array<int> lfliebertjes;
Array<int> rfliebertjes;
Array<int> lfliebertjes;
Array<int> rfliebertjes;
int b = gh_scm2int (gh_car (s));
if (scm_memq (gh_car(s), right) != SCM_BOOL_F)
{
int b = gh_scm2int (gh_car (s));
if (scm_memq (gh_car(s), right) != SCM_BOOL_F)
{
width_corr += stem_width/2;
}
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);
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--;)
+
+ 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 (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);
}
the_beam.add_molecule (b);
}
if (lfliebertjes.size() || rfliebertjes.size())
{
Real nw_f;
if (lfliebertjes.size() || rfliebertjes.size())
{
Real nw_f;
Moment start_mom_;
Moment stop_mom_;
int flags_ ;
Moment start_mom_;
Moment stop_mom_;
int flags_ ;
+ int total_duration_flags_;
+
/// location within measure where beam started.
Moment beam_start_location_;
/// 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 ());
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 ;
flags_ = intlog2 (note_dur.den ()) -2 ;
else
Stem::set_beaming (s, flags_, LEFT);
else
Stem::set_beaming (s, flags_, LEFT);
- SCM d = s->get_grob_property ("direction");
if (Stem::duration_log (s) != 1)
{
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"))
{
if (info.music_cause ()->is_mus_type ("rhythmic-event"))
{
(molecule-callback . ,Beam::brew_molecule)
(concaveness-gap . 2.0)
(concaveness-threshold . 0.08)
(molecule-callback . ,Beam::brew_molecule)
(concaveness-gap . 2.0)
(concaveness-threshold . 0.08)
(positions . (#f . #f))
(position-callbacks . (,Beam::least_squares
,Beam::check_concave
(positions . (#f . #f))
(position-callbacks . (,Beam::least_squares
,Beam::check_concave