2 note-name-engraver.cc -- implement Note_name_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
12 #include "stream-event.hh"
14 #include "translator.icc"
16 class Note_name_engraver
: public Engraver
19 TRANSLATOR_DECLARATIONS (Note_name_engraver
);
21 vector
<Stream_event
*> events_
;
23 DECLARE_TRANSLATOR_LISTENER (note
);
24 void process_music ();
25 void stop_translation_timestep ();
28 IMPLEMENT_TRANSLATOR_LISTENER (Note_name_engraver
, note
);
30 Note_name_engraver::listen_note (Stream_event
*ev
)
32 events_
.push_back (ev
);
36 Note_name_engraver::process_music ()
39 for (vsize i
= 0; i
< events_
.size (); i
++)
43 Pitch p
= *unsmob_pitch (events_
[i
]->get_property ("pitch"));
45 if (!to_boolean (get_property ("printOctaveNames")))
46 p
= Pitch (-1, p
.get_notename (), p
.get_alteration ());
52 Item
*t
= make_item ("NoteName", events_
[0]->self_scm ());
53 t
->set_property ("text", ly_string2scm (s
));
59 Note_name_engraver::stop_translation_timestep ()
65 Note_name_engraver::Note_name_engraver ()
69 ADD_TRANSLATOR (Note_name_engraver
,
71 "Print pitches as words.",