source file of the GNU LilyPond music typesetter
- (c) 2000 Glen Prideaux <glenprideaux@iname.com>
+ (c) 2000--2003 Glen Prideaux <glenprideaux@iname.com>
*/
#include <string.h>
#include "warn.hh"
-String get_context_id (Translator_group * ancestor, const char * type);
+String get_context_id (Translator_group * ancestor, SCM);
String trim_suffix (String &id);
Syllable_group *
Lyric_phrasing_engraver::lookup_context_id (const String &context_id)
{
- SCM key = ly_str02scm (context_id.to_str0 ());
+ SCM key = scm_makfrom0str (context_id.to_str0 ());
if (! gh_null_p (voice_alist_))
{
SCM s = scm_assoc (key, voice_alist_);
/* match found */
// (key . ((alist_entry . old_entry) . previous_entry))
if (to_boolean (ly_cdadr (s)))
- { // it's an old entry ... make it a new one
+ {
+ // it's an old entry ... make it a new one
SCM val = gh_cons (gh_cons (ly_caadr (s), SCM_BOOL_F), ly_cddr (s));
voice_alist_ = scm_assoc_set_x (voice_alist_, ly_car (s), val);
return unsmob_voice_entry (ly_caar (val));
}
- else { // the entry is current ... return it.
+ else
+ {
+ // the entry is current ... return it.
SCM entry_scm = ly_caadr (s);
return unsmob_voice_entry (entry_scm);
}
void
Lyric_phrasing_engraver::record_extender (const String &context_id, Grob * extender)
{
- SCM key = ly_str02scm (context_id.to_str0 ());
+ SCM key = scm_makfrom0str (context_id.to_str0 ());
if (! gh_null_p (voice_alist_))
{
SCM s = scm_assoc (key, voice_alist_);
Syllable_group * v = lookup_context_id (context_id);
v->set_melisma ();
}
-
+
+/*
+ TODO: this engraver is always on, also for orchestral scores. That
+ is a waste of time and space. This should be switched on
+ automatically at the first Lyrics found.
+ */
void
Lyric_phrasing_engraver::acknowledge_grob (Grob_info i)
{
/* caught a note head ... do something with it */
/* what's its Voice context name? */
- String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, "Voice");
+ String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, ly_symbol2scm ("Voice"));
record_notehead (voice_context_id, h);
/* is it in a melisma ? */
{
voice_context_id = ly_scm2string (voice_context_scm);
}
- else {
- voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, "LyricsVoice");
- voice_context_id = trim_suffix (voice_context_id);
- }
+ else
+ {
+ voice_context_id = get_context_id (i.origin_trans_->daddy_trans_,ly_symbol2scm ( "LyricsVoice"));
+ voice_context_id = trim_suffix (voice_context_id);
+ }
record_lyric (voice_context_id, h);
return;
}
This has the effect of finishing the extender under the last note
of the melisma, instead of extending it to the next lyric.
- Problem: the extender request is thrown at the same moment as the next lyric,
+ Problem: the extender event is thrown at the same moment as the next lyric,
by which time we have already passed the last note of the melisma.
However, the Lyric_phrasing_engraver remembers the last note, so just
attach it to that, provided it was melismatic. If it was not melismatic,
*/
if (h->internal_has_interface (ly_symbol2scm ("lyric-extender-interface")))
{
- String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, "LyricsVoice");
+ String voice_context_id = get_context_id (i.origin_trans_->daddy_trans_, ly_symbol2scm ("LyricsVoice"));
record_extender (trim_suffix (voice_context_id), h);
return;
}
}
String
-get_context_id (Translator_group * ancestor, const char *type)
+get_context_id (Translator_group * ancestor, SCM type)
{
- while (ancestor != 0 && ancestor->type_string_ != type)
+ while (ancestor != 0 && !ancestor->is_alias_b(type))
{
ancestor = ancestor->daddy_trans_;
}
SCM v_entry = ly_cdar (v);
// ((current . oldflag) . previous)
if (!to_boolean (ly_cdar (v_entry)))
- { // not an old entry left over from a prior note ...
+ {
+ // not an old entry left over from a prior note ...
Syllable_group *entry = unsmob_voice_entry (ly_caar (v_entry));
/*
ENTER_DESCRIPTION(Lyric_phrasing_engraver,
- /* descr */ "",
+ /* descr */
+"This engraver combines note heads and lyrics for alignment. "
+"\n\n"
+"This engraver is switched on by default. Turn it off for faster "
+"processing of orchestral scores. ",
/* creats*/ "",
- /* acks */ "lyric-syllable-interface note-head-interface lyric-extender-interface",
+ /* accepts */ "",
+/* acks */ "lyric-syllable-interface note-head-interface lyric-extender-interface",
/* reads */ "automaticPhrasing melismaEngraverBusy associatedVoice phrasingPunctuation",
/* write */ "");