* Documentation/topdocs/NEWS.tely (Top): typo.
2006-05-06 Han-Wen Nienhuys <hanwen@lilypond.org>
2006-05-06 Han-Wen Nienhuys <hanwen@lilypond.org>
+ * lily/beam.cc: read grow-direction for feathered beaming.
+
* Documentation/topdocs/NEWS.tely (Top): typo.
2006-05-05 Han-Wen Nienhuys <hanwen@lilypond.org>
* Documentation/topdocs/NEWS.tely (Top): typo.
2006-05-05 Han-Wen Nienhuys <hanwen@lilypond.org>
+@item
+The beam printing code has been completely rewritten, and now includes
+support for feathered beaming,
+
+@lilypond[ragged-right,fragment,relative=2]
+ \override Beam #'grow-direction = #LEFT
+ c16[
+ c c c
+ c c c c ]
+@end lilypond
+
+This feature was sponsored by Jamie Bullock.
+
@item
The @code{\note} markup command now also accepts note head styles.
@lilypond[ragged-right,fragment,relative=2]
c4^\markup {
\override #'(style . triangle) \note-by-number #2 #1 #1 = 100
@item
The @code{\note} markup command now also accepts note head styles.
@lilypond[ragged-right,fragment,relative=2]
c4^\markup {
\override #'(style . triangle) \note-by-number #2 #1 #1 = 100
--- /dev/null
+\header {
+
+ texidoc = "Specifying @code{grow-direction} on a beam, will cause
+ feathered beaming. The @code{\featherDurations} function can be used
+ to adjust note durations."
+
+}
+
+\version "2.9.4"
+
+\paper {
+ ragged-right = ##t
+ indent = #0.0
+}
+
+\featherDurations #(ly:make-moment 3 4) \relative c'' {
+ \override Beam #'grow-direction = #LEFT
+ c16[
+ c c c
+ c c c c ]
+}
Grob *commonx = 0;
vector<Beam_segment> segments = get_beam_segments (me, &commonx);
Grob *commonx = 0;
vector<Beam_segment> segments = get_beam_segments (me, &commonx);
if (visible_stem_count (me))
{
if (visible_stem_count (me))
{
- x0 = first_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
- dx = last_visible_stem (me)->relative_coordinate (commonx, X_AXIS) - x0;
+ span[LEFT] = first_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
+ span[RIGHT] = last_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
}
else
{
extract_grob_set (me, "stems", stems);
}
else
{
extract_grob_set (me, "stems", stems);
- x0 = stems[0]->relative_coordinate (commonx, X_AXIS);
- dx = stems.back ()->relative_coordinate (commonx, X_AXIS) - x0;
+ span[LEFT] = stems[0]->relative_coordinate (commonx, X_AXIS);
+ span[RIGHT] = stems.back ()->relative_coordinate (commonx, X_AXIS);
}
Real blot = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
SCM posns = me->get_property ("quantized-positions");
}
Real blot = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter"));
SCM posns = me->get_property ("quantized-positions");
if (!is_number_pair (posns))
{
programming_error ("no beam positions?");
if (!is_number_pair (posns))
{
programming_error ("no beam positions?");
scale_drul (&pos, Staff_symbol_referencer::staff_space (me));
Real dy = pos[RIGHT] - pos[LEFT];
scale_drul (&pos, Staff_symbol_referencer::staff_space (me));
Real dy = pos[RIGHT] - pos[LEFT];
- Real slope = (dy && dx) ? dy / dx : 0;
+ Real slope = (dy && span.length ()) ? dy / span.length () : 0;
Real thick = get_thickness (me);
Real beam_dy = get_beam_translation (me);
Real thick = get_thickness (me);
Real beam_dy = get_beam_translation (me);
+ Direction feather_dir = to_dir (me->get_property ("grow-direction"));
+
Stencil the_beam;
for (vsize i = 0; i < segments.size (); i ++)
{
Stencil the_beam;
for (vsize i = 0; i < segments.size (); i ++)
{
- Stencil b = Lookup::beam (slope, segments[i].horizontal_.length (), thick, blot);
+ Real local_slope = slope;
+ if (feather_dir)
+ {
+ local_slope += feather_dir * segments[i].vertical_count_ * beam_dy / span.length ();
+ }
+
+ Stencil b = Lookup::beam (local_slope, segments[i].horizontal_.length (), thick, blot);
b.translate_axis (segments[i].horizontal_[LEFT], X_AXIS);
b.translate_axis (segments[i].horizontal_[LEFT], X_AXIS);
- b.translate_axis (slope * (segments[i].horizontal_[LEFT] - x0)
+
+ b.translate_axis (local_slope
+ * (segments[i].horizontal_[LEFT] - span.linear_combination (feather_dir))
+ + pos.linear_combination (feather_dir)
+ beam_dy * segments[i].vertical_count_, Y_AXIS);
the_beam.add_stencil (b);
}
+ beam_dy * segments[i].vertical_count_, Y_AXIS);
the_beam.add_stencil (b);
}
- the_beam.translate_axis (pos[LEFT], Y_AXIS);
the_beam.translate_axis (-me->relative_coordinate (commonx, X_AXIS), X_AXIS);
return the_beam.smobbed_copy ();
}
the_beam.translate_axis (-me->relative_coordinate (commonx, X_AXIS), X_AXIS);
return the_beam.smobbed_copy ();
}
"direction "
"gap "
"gap-count "
"direction "
"gap "
"gap-count "
"inspect-quants "
"knee "
"length-fraction "
"inspect-quants "
"knee "
"length-fraction "
for (SCM s = l; scm_is_pair (s); s = scm_cdr (s))
{
Music *m = unsmob_music (scm_car (s));
for (SCM s = l; scm_is_pair (s); s = scm_cdr (s))
{
Music *m = unsmob_music (scm_car (s));
- Moment l = m->get_length ();
- dur = max (dur, l);
+ if (!m)
+ programming_error ("Music sequence should have music elements");
+ else
+ {
+ Moment l = m->get_length ();
+ dur = max (dur, l);
+ }
(set! (ly:music-property arg 'parenthesize) #t)
arg)
(set! (ly:music-property arg 'parenthesize) #t)
arg)
+
+
+featherDurations=
+#(define-music-function (parser location factor argument) (ly:moment? ly:music?)
+ (let*
+ ((orig-duration (ly:music-length argument))
+ (multiplier (ly:make-moment 1 1))
+ )
+
+ (music-map
+ (lambda (mus)
+ (if (and (eq? (ly:music-property mus 'name) 'EventChord)
+ (< 0 (ly:moment-main-denominator (ly:music-length mus))))
+ (begin
+ (ly:music-compress mus multiplier)
+ (set! multiplier (ly:moment-mul factor multiplier)))
+ )
+ mus)
+ argument)
+
+ (display (list (ly:music-length argument) orig-duration))
+ (ly:music-compress
+ argument
+ (ly:moment-div orig-duration (ly:music-length argument)))
+
+ argument))
+