+ /* Stem tremolo is never applied to a note by default,
+ it must be requested. But there is a default for the
+ tremolo value:
+
+ c4:8 c c:
+
+ the first and last (quarter) note both get one tremolo flag. */
+ int requested_type
+ = robust_scm2int (tremolo_ev_->get_property ("tremolo-type"), 8);
+
+ /*
+ we take the duration log from the Event, since the duration-log
+ for a note head is always <= 2.
+ */
+ Stream_event *ev = gi.event_cause ();
+ Duration *dur = Duration::unsmob (ev->get_property ("duration"));
+
+ int tremolo_flags = intlog2 (requested_type) - 2
+ - (dur->duration_log () > 2 ? dur->duration_log () - 2 : 0);
+ if (tremolo_flags <= 0)
+ {
+ tremolo_ev_->origin ()->warning (_ ("tremolo duration is too long"));
+ tremolo_flags = 0;
+ }
+
+ if (tremolo_flags)
+ {
+ tremolo_ = make_item ("StemTremolo", tremolo_ev_->self_scm ());
+
+ /* The number of tremolo flags is the number of flags of the
+ tremolo-type minus the number of flags of the note itself. */
+ tremolo_->set_property ("flag-count", scm_from_int (tremolo_flags));
+ tremolo_->set_parent (stem_, X_AXIS);
+ stem_->set_object ("tremolo-flag", tremolo_->self_scm ());
+ tremolo_->set_object ("stem", stem_->self_scm ());
+ }