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"
13 #include "stream-event.hh"
16 #include "translator.icc"
19 Convert evs to audio notes.
21 class Note_performer : public Performer
24 TRANSLATOR_DECLARATIONS (Note_performer);
27 void stop_translation_timestep ();
28 void process_music ();
30 DECLARE_TRANSLATOR_LISTENER (note);
32 vector<Stream_event*> note_evs_;
33 vector<Audio_note*> notes_;
37 Note_performer::process_music ()
39 if (note_evs_.size ())
43 SCM prop = get_property ("instrumentTransposition");
44 if (unsmob_pitch (prop))
45 transposing = unsmob_pitch (prop)->semitone_pitch ();
47 while (note_evs_.size ())
49 Stream_event *n = note_evs_.back ();
50 note_evs_.pop_back ();
51 SCM pit = n->get_property ("pitch");
53 if (Pitch *pitp = unsmob_pitch (pit))
55 SCM articulations = n->get_property ("articulations");
56 Stream_event *tie_event = 0;
57 for (SCM s = articulations;
58 !tie_event && scm_is_pair (s);
61 Stream_event *ev = unsmob_stream_event (scm_car (s));
65 if (ev->in_event_class ("tie-event"))
69 Audio_note *p = new Audio_note (*pitp, get_event_length (n),
70 tie_event, - transposing);
71 Audio_element_info info (p, n);
72 announce_element (info);
81 Note_performer::stop_translation_timestep ()
83 // why don't grace notes show up here?
84 // --> grace notes effectively do not get delayed
89 IMPLEMENT_TRANSLATOR_LISTENER (Note_performer, note)
91 Note_performer::listen_note (Stream_event *ev)
93 note_evs_.push_back (ev);
96 ADD_TRANSLATOR (Note_performer, "", "",
99 Note_performer::Note_performer ()