2 chord-name-engraver.cc -- implement Chord_name_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "chord-name-engraver.hh"
10 #include "chord-name.hh"
11 #include "musical-request.hh"
12 #include "paper-def.hh"
14 #include "paper-def.hh"
16 #include "dimensions.hh"
17 #include "text-item.hh"
18 #include "lily-guile.icc"
20 ADD_THIS_TRANSLATOR (Chord_name_engraver);
22 Chord_name_engraver::Chord_name_engraver ()
31 Chord_name_engraver::acknowledge_element (Score_element_info i)
33 if (Note_req* n = dynamic_cast<Note_req*> (i.req_l_))
34 pitch_arr_.push (n->pitch_);
38 Chord_name_engraver::do_try_music (Music* m)
40 if (Note_req* n = dynamic_cast<Note_req*> (m))
42 pitch_arr_.push (n->pitch_);
45 if (Tonic_req* t = dynamic_cast<Tonic_req*> (m))
50 if (Inversion_req* i = dynamic_cast<Inversion_req*> (m))
55 if (Bass_req* b = dynamic_cast<Bass_req*> (m))
64 Chord_name_engraver::do_process_music ()
68 if (!pitch_arr_.size ())
71 bool find_inversion_b = false;
72 SCM chord_inversion = get_property ("chordInversion");
73 if (gh_boolean_p (chord_inversion))
74 find_inversion_b = gh_scm2bool (chord_inversion);
76 chord_name_p_ = new Chord_name;
77 Chord chord = to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_,
81 Hmm, why not represent complete chord as list?
82 ((tonic third fifth) (inversion bass))
84 chord_name_p_->set_elt_property ("pitches", array_to_scm (chord.pitch_arr_));
85 if (chord.inversion_b_)
86 chord_name_p_->set_elt_property ("inversion",
87 to_scm (chord.inversion_pitch_));
89 chord_name_p_->set_elt_property ("bass", to_scm (chord.bass_pitch_));
91 announce_element (Score_element_info (chord_name_p_, 0));
95 Chord_name_engraver::do_pre_move_processing ()
99 typeset_element (chord_name_p_);