- int duration_log = 0;
-
- Music * m = i.music_cause ();
- if (m->is_mus_type ("rhythmic-event"))
- duration_log = unsmob_duration (m->get_mus_property ("duration"))-> duration_log ();
-
- if (!stem_)
- {
- stem_ = new Item (get_property ("Stem"));
-
- stem_->set_grob_property ("duration-log", gh_int2scm (duration_log));
-
- if (tremolo_req_)
- {
- /*
- Stem tremolo is never applied to a note by default,
- is must me evented. 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 evented_type = gh_scm2int (tremolo_req_->get_mus_property ("tremolo-type"));
- SCM f = get_property ("tremoloFlags");
- if (!evented_type && gh_number_p (f))
- evented_type = gh_scm2int (f);
- else
- daddy_trans_->set_property ("tremoloFlags", gh_int2scm (evented_type));
-
- int tremolo_flags = intlog2 (evented_type) - 2
- - (duration_log > 2 ? duration_log - 2 : 0);
- if (tremolo_flags <= 0)
- {
- tremolo_req_->origin()->warning (_("tremolo duration is too long"));
- tremolo_flags = 0;
- }
-
- if (tremolo_flags)
- {
- tremolo_ = new Item (get_property ("StemTremolo"));
- announce_grob(tremolo_, tremolo_req_->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_grob_property ("flag-count",
- gh_int2scm (tremolo_flags));
- tremolo_->set_parent (stem_, X_AXIS);
- }
- }
-
- /*
- 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_)));
- }
-
- Stem::add_head (stem_,h);
+ 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 ());
+ }