- int duration_log = 0;
-
- Music * m = i.music_cause ();
- if (m->is_mus_type ("rhythmic-event"))
- duration_log = unsmob_duration (m->get_property ("duration"))-> duration_log ();
-
- if (!stem_)
- {
- stem_ = make_item ("Stem");
-
- stem_->set_property ("duration-log", scm_int2num (duration_log));
-
- if (tremolo_ev_)
- {
- /*
- Stem tremolo is never applied to a note by default,
- is must me evuested. But there is a default for the
- tremolo value:
-
- c4:8 c c:
-
- the first and last (quarter) note bothe get one tremolo flag.
- */
- int requested_type = ly_scm2int (tremolo_ev_->get_property ("tremolo-type"));
- SCM f = get_property ("tremoloFlags");
- if (!requested_type)
- if (is_number (f))
- requested_type = ly_scm2int (f);
- else
- requested_type = 8;
- else
- get_parent_context ()->set_property ("tremoloFlags", scm_int2num (requested_type));
-
- int tremolo_flags = intlog2 (requested_type) - 2
- - (duration_log > 2 ? 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");
- announce_grob (tremolo_, 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_int2num (tremolo_flags));
- tremolo_->set_parent (stem_, X_AXIS);
- stem_->set_property ("tremolo-flag", tremolo_->self_scm ());
- tremolo_->set_property ("stem",
- stem_->self_scm ());
- }
- }
-
- /*
- We announce the cause of the head as cause of the stem.
- The stem needs a rhythmic structure to fit it into a beam. */
- announce_grob (stem_, i.music_cause ()->self_scm ());
- }
-
- if (Stem::duration_log (stem_) != duration_log)
- {
- i.music_cause ()->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::duration_log (stem_))
- + _f ("Don't you want polyphonic voices instead?")
- );
- }
-
- Stem::add_head (stem_,h);
+ Stream_event *ev = gi.event_cause ();
+ Duration *dur = unsmob<Duration> (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 ());
+ }