- We take the duration-log of the head; this is because
- auto-tieing does strange things with the rhythmics.
- */
- int duration_log =gh_scm2int (h->get_grob_property ("duration-log"));
- if (!stem_p_)
- {
- stem_p_ = new Item (get_property ("Stem"));
- Stem::set_interface (stem_p_);
- Staff_symbol_referencer::set_interface (stem_p_);
-
- stem_p_->set_grob_property ("duration-log", gh_int2scm (duration_log));
-
- if (tremolo_req_l_)
- {
- /*
- Stem tremolo is never applied to a note by default,
- is must me requested. 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 = gh_scm2int (tremolo_req_l_->get_mus_property ("tremolo-type"));
-
- SCM f = get_property ("tremoloFlags");
- if (!requested_type && gh_number_p (f))
- requested_type = gh_scm2int (f);
- else
- daddy_trans_l_->set_property ("tremoloFlags", gh_int2scm (requested_type));
-
- if (requested_type)
- {
- tremolo_p_ = new Item (get_property ("StemTremolo"));
- Stem_tremolo::set_interface (tremolo_p_);
-
- announce_grob (tremolo_p_, tremolo_req_l_);
- /*
- The number of tremolo flags is the number of flags of
- the tremolo-type minus the number of flags of the note
- itself.
- */
- int tremolo_flags = intlog2 (requested_type) - 2
- - (duration_log > 2 ? duration_log - 2 : 0);
- if (tremolo_flags < 0)
- tremolo_flags = 0;
- tremolo_p_->set_grob_property ("tremolo-flags",
- gh_int2scm (tremolo_flags));
- }
- }
- announce_grob (stem_p_, i.req_l_);
- }
-
- if (Stem::flag_i (stem_p_) != duration_log)
- {
- i.req_l_->origin ()->warning (_f ("Adding note head to incompatible stem (type = %d)", 1 << Stem::flag_i (stem_p_)));
- }
-
- Stem::add_head (stem_p_,h);
+ 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 = 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 ());
+ }