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"
17 Convert evs to audio notes.
19 class Note_performer : public Performer
22 TRANSLATOR_DECLARATIONS (Note_performer);
25 virtual bool try_music (Music *ev);
27 void stop_translation_timestep ();
28 void process_music ();
31 Link_array__Music_ note_evs_;
32 Link_array__Audio_note_ notes_;
36 Note_performer::process_music ()
38 if (note_evs_.size ())
42 SCM prop = get_property ("instrumentTransposition");
43 if (unsmob_pitch (prop))
44 transposing = unsmob_pitch (prop)->semitone_pitch ();
46 while (note_evs_.size ())
48 Music *n = note_evs_.back ();
49 note_evs_.pop_back ();
50 SCM pit = n->get_property ("pitch");
52 if (Pitch *pitp = unsmob_pitch (pit))
54 Audio_note *p = new Audio_note (*pitp, n->get_length (), - transposing);
55 Audio_element_info info (p, n);
56 announce_element (info);
65 Note_performer::stop_translation_timestep ()
67 // why don't grace notes show up here?
68 // --> grace notes effectively do not get delayed
69 Moment now = now_mom ();
70 for (vsize i = 0; i < notes_.size (); i++)
71 play_element (notes_[i]);
77 Note_performer::try_music (Music *ev)
79 if (ev->is_mus_type ("note-event"))
81 note_evs_.push_back (ev);
84 else if (ev->is_mus_type ("busy-playing-event"))
85 return note_evs_.size ();
90 #include "translator.icc"
92 ADD_TRANSLATOR (Note_performer, "", "",
97 Note_performer::Note_performer ()