LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- we take the duration log from the Event, since the duration-log
- for a note head is always <= 2.
+ 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"));
*/
Stream_event *ev = gi.event_cause ();
Duration *dur = unsmob_duration (ev->get_property ("duration"));
- {
- 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 ());
- }
+ {
+ 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 ());
+ }
- if (Stem::duration_log (stem_) != d->duration_log ())
+ int ds = Stem::duration_log (stem_);
+ int dc = d->duration_log ();
+
+ // half notes and quarter notes all have compatible stems.
+ // Longas are done differently (oops?), so we can't unify
+ // them with the other stemmed notes.
+ if (ds == 1)
+ ds = 2;
+ if (dc == 1)
+ dc = 2;
+ // whole notes and brevis both have no stems
+ if (ds == -1)
+ ds = 0;
+ if (dc == -1)
+ dc = 0;
+
+ if (ds != dc)
- // FIXME:
- gi.event_cause ()->origin ()->warning (_f ("adding note head to incompatible stem (type = %d)",
- 1 << Stem::duration_log (stem_)));
+ gi.event_cause ()->origin ()->warning (_f ("adding note head to incompatible stem (type = %d/%d)",
+ ds < 0 ? 1 << -ds : 1,
+ ds > 0 ? 1 << ds : 1));
/* FIXME: junk these properties. */
SCM prop = get_property ("stemLeftBeamCount");
if (scm_is_number (prop))
/* FIXME: junk these properties. */
SCM prop = get_property ("stemLeftBeamCount");
if (scm_is_number (prop))
- {
- Stem::set_beaming (stem_, scm_to_int (prop), LEFT);
- context ()->unset_property (ly_symbol2scm ("stemLeftBeamCount"));
- }
+ {
+ Stem::set_beaming (stem_, scm_to_int (prop), LEFT);
+ context ()->unset_property (ly_symbol2scm ("stemLeftBeamCount"));
+ }
- {
- Stem::set_beaming (stem_, scm_to_int (prop), RIGHT);
- context ()->unset_property (ly_symbol2scm ("stemRightBeamCount"));
- }
+ {
+ Stem::set_beaming (stem_, scm_to_int (prop), RIGHT);
+ context ()->unset_property (ly_symbol2scm ("stemRightBeamCount"));
+ }
ADD_ACKNOWLEDGER (Stem_engraver, rhythmic_head);
ADD_TRANSLATOR (Stem_engraver,
ADD_ACKNOWLEDGER (Stem_engraver, rhythmic_head);
ADD_TRANSLATOR (Stem_engraver,
- /* doc */
- "Create stems and single-stem tremolos. It also works"
- " together with the beam engraver for overriding beaming.",
-
- /* create */
- "Stem "
- "StemTremolo ",
-
- /* read */
- "tremoloFlags "
- "stemLeftBeamCount "
- "stemRightBeamCount ",
-
- /* write */
- ""
- );
+ /* doc */
+ "Create stems and single-stem tremolos. It also works"
+ " together with the beam engraver for overriding beaming.",
+
+ /* create */
+ "Stem "
+ "StemTremolo ",
+
+ /* read */
+ "tremoloFlags "
+ "stemLeftBeamCount "
+ "stemRightBeamCount ",
+
+ /* write */
+ ""
+ );