class Accidental_engraver : public Engraver
{
- int get_bar_number ();
void update_local_key_signature (SCM new_signature);
void create_accidental (Accidental_entry *entry, bool, bool);
Grob *make_standard_accidental (Stream_event *note, Grob *note_head, Engraver *trans, bool);
return result;
}
-int
-Accidental_engraver::get_bar_number ()
-{
- SCM barnum = get_property ("internalBarNumber");
- SCM smp = get_property ("measurePosition");
-
- int bn = robust_scm2int (barnum, 0);
-
- Moment mp = robust_scm2moment (smp, Moment (0));
- if (mp.main_part_ < Rational (0))
- bn--;
-
- return bn;
-}
-
void
Accidental_engraver::process_acknowledged ()
{
{
SCM accidental_rules = get_property ("autoAccidentals");
SCM cautionary_rules = get_property ("autoCautionaries");
- int barnum = get_bar_number ();
+ int barnum = measure_number (context());
for (vsize i = 0; i < accidentals_.size (); i++)
{
/* Cannot look for ties: it's not guaranteed that they reach
us before the notes. */
- if (acc.need_acc
- && !note->in_event_class ("trill-span-event"))
- create_accidental (&accidentals_[i], acc.need_restore, cautionary);
+ if (!note->in_event_class ("trill-span-event"))
+ {
+ if (acc.need_acc)
+ create_accidental (&accidentals_[i], acc.need_restore, cautionary);
- if (forced || cautionary)
- accidentals_[i].accidental_->set_property ("forced", SCM_BOOL_T);
+ if (forced || cautionary)
+ accidentals_[i].accidental_->set_property ("forced", SCM_BOOL_T);
+ }
}
}
}
}
for (vsize i = accidentals_.size (); i--;)
- {
- int barnum = get_bar_number ();
-
+ {
Stream_event *note = accidentals_[i].melodic_;
Context *origin = accidentals_[i].origin_;
+ int barnum = measure_number (origin);
+
Pitch *pitch = unsmob_pitch (note->get_property ("pitch"));
if (!pitch)
continue;