Stream_event *note = info.event_cause ();
if (note
&& (note->in_event_class ("note-event")
- || note->in_event_class ("trill-span-event")))
+ || note->in_event_class ("trill-span-event"))
+ // option to skip accidentals on string harmonics
+ && (to_boolean (get_property ("harmonicAccidentals"))
+ || info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic"))
+ // ignore accidentals in non-printing voices like NullVoice
+ && !to_boolean (info.context ()->get_property ("nullAccidentals")))
{
- /*
- string harmonics usually don't have accidentals.
- */
- if (info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic")
- || to_boolean (get_property ("harmonicAccidentals")))
- {
- Accidental_entry entry;
- entry.head_ = info.grob ();
- entry.origin_engraver_ = dynamic_cast<Engraver *> (info.origin_translator ());
- entry.origin_ = entry.origin_engraver_->context ();
- entry.melodic_ = note;
+ Accidental_entry entry;
+ entry.head_ = info.grob ();
+ entry.origin_engraver_ = dynamic_cast<Engraver *> (info.origin_translator ());
+ entry.origin_ = entry.origin_engraver_->context ();
+ entry.melodic_ = note;
- accidentals_.push_back (entry);
- }
+ accidentals_.push_back (entry);
}
}
\defaultchild "Voice"
\accepts "Voice"
\accepts "CueVoice"
+ \accepts "NullVoice"
\description "Handles clefs, bar lines, keys, accidentals. It can contain
@code{Voice} contexts."
\override NoteHead.X-extent = #(lambda (g)
(ly:stencil-extent (ly:note-head::print g) X))
- \omit Accidental
- \omit AccidentalCautionary
- \omit AccidentalSuggestion
+ % generate no accidentals
+ nullAccidentals = ##t
+
+ %% keep noteheads inside the staff
+ \consists "Pitch_squash_engraver"
+ squashedPosition = 0
% the engravers that control the 'busy' flags for note-onsets and melismata
\consists "Grob_pq_engraver"
\name Staff
\accepts Voice
\accepts CueVoice
+ \accepts NullVoice
\defaultchild Voice
\consists "Staff_performer"
defined strings to full list of strings and fret numbers.
Parameters: The context, a list of note events, a list of
tabstring events, and the fretboard grob if a fretboard is desired.")
-
+ (nullAccidentals ,boolean? "The @code{Accidental_engraver}
+generates no accidentals for notes in contexts were this is set.
+In addition to supressing the printed accidental, this option removes
+any effect the note would have had on accidentals in other voices.")
(ottavation ,markup? "If set, the text for an ottava spanner.
Changing this creates a new text spanner.")