- SCM oct = inversion_event->get_property ("octavation");
- if (scm_is_number (oct))
- {
- Pitch *p = unsmob_pitch (inversion_event->get_property ("pitch"));
- int octavation = scm_to_int (oct);
- Pitch orig = p->transposed (Pitch (-octavation, 0, 0));
-
- pitches = scm_cons (orig.smobbed_copy (), pitches);
- }
- else
- programming_error ("inversion does not have original pitch");
+ chord_name = make_item ("ChordName", notes_[0]->self_scm ());
+ // We cannot actually delay fetching the text property in case
+ // it is a callback since we need to compare the generated
+ // markups for the sake of chordChanges
+ markup = chord_name->get_property ("text");
+ if (!Text_interface::is_markup (markup))
+ {
+ for (vsize i = 0; i < notes_.size (); i++)
+ {
+ Stream_event *n = notes_[i];
+ SCM p = n->get_property ("pitch");
+ if (!unsmob<Pitch> (p))
+ continue;
+
+ if (to_boolean (n->get_property ("bass")))
+ bass = p;
+ else
+ {
+ SCM oct = n->get_property ("octavation");
+ if (scm_is_number (oct))
+ {
+ Pitch orig = unsmob<Pitch> (p)->transposed (Pitch (-scm_to_int (oct), 0));
+ pitches = scm_cons (orig.smobbed_copy (), pitches);
+ }
+ else
+ pitches = scm_cons (p, pitches);
+ if (to_boolean (n->get_property ("inversion")))
+ {
+ inversion = p;
+ if (!scm_is_number (oct))
+ programming_error ("inversion does not have original pitch");
+ }
+ }
+ }
+
+ pitches = scm_sort_list (pitches, Pitch::less_p_proc);
+
+ SCM name_proc = get_property ("chordNameFunction");
+ markup = scm_call_4 (name_proc, pitches, bass, inversion,
+ context ()->self_scm ());
+ if (!Text_interface::is_markup (markup))
+ {
+ // Ugh, we created a grob, now we better populate it.
+ // Use an empty string.
+ markup = scm_string (SCM_EOL);
+ }
+ chord_name->set_property ("text", markup);
+ }