2 note-performer.cc -- implement Note_performer
4 source file of the GNU LilyPond music typesetter
6 (c) 1996--2006 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "performer.hh"
10 #include "audio-item.hh"
11 #include "audio-column.hh"
12 #include "global-context.hh"
14 #include "stream-event.hh"
17 #include "translator.icc"
20 Convert evs to audio notes.
22 class Note_performer : public Performer
25 TRANSLATOR_DECLARATIONS (Note_performer);
28 void stop_translation_timestep ();
29 void process_music ();
31 DECLARE_TRANSLATOR_LISTENER (note);
33 vector<Stream_event*> note_evs_;
34 vector<Audio_note*> notes_;
38 Note_performer::process_music ()
40 if (note_evs_.size ())
44 SCM prop = get_property ("instrumentTransposition");
45 if (unsmob_pitch (prop))
46 transposing = unsmob_pitch (prop)->semitone_pitch ();
48 while (note_evs_.size ())
50 Stream_event *n = note_evs_.back ();
51 note_evs_.pop_back ();
52 SCM pit = n->get_property ("pitch");
54 if (Pitch *pitp = unsmob_pitch (pit))
56 SCM articulations = n->get_property ("articulations");
58 for (SCM s = articulations;
59 !tie_event && scm_is_pair (s);
62 Music *m = unsmob_music (scm_car (s));
66 if (m->is_mus_type ("tie-event"))
70 Audio_note *p = new Audio_note (*pitp, get_event_length (n),
71 tie_event, - transposing);
72 Audio_element_info info (p, n);
73 announce_element (info);
82 Note_performer::stop_translation_timestep ()
84 // why don't grace notes show up here?
85 // --> grace notes effectively do not get delayed
90 IMPLEMENT_TRANSLATOR_LISTENER (Note_performer, note)
92 Note_performer::listen_note (Stream_event *ev)
94 note_evs_.push_back (ev);
97 ADD_TRANSLATOR (Note_performer, "", "",
101 Note_performer::Note_performer ()