2 note-performer.cc -- implement Drum_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 class Drum_note_performer : public Performer
20 TRANSLATOR_DECLARATIONS (Drum_note_performer);
23 virtual bool try_music (Music *ev);
24 void stop_translation_timestep ();
25 void process_music ();
28 Link_array<Music> note_evs_;
29 Link_array<Audio_note> notes_;
32 Drum_note_performer::Drum_note_performer ()
37 Drum_note_performer::process_music ()
39 SCM tab = get_property ("drumPitchTable");
41 while (note_evs_.size ())
43 Music *n = note_evs_.pop ();
44 SCM sym = n->get_property ("drum-type");
47 if (scm_is_symbol (sym)
48 && (scm_hash_table_p (tab) == SCM_BOOL_T))
49 defn = scm_hashq_ref (tab, sym, SCM_EOL);
51 if (Pitch *pit = unsmob_pitch (defn))
53 Audio_note *p = new Audio_note (*pit, n->get_length (), 0);
54 Audio_element_info info (p, n);
55 announce_element (info);
64 Drum_note_performer::stop_translation_timestep ()
66 // why don't grace notes show up here?
67 // --> grace notes effectively do not get delayed
68 Moment now = now_mom ();
69 for (int i = 0; i < notes_.size (); i++)
70 play_element (notes_[i]);
76 Drum_note_performer::try_music (Music *ev)
78 if (ev->is_mus_type ("note-event"))
83 else if (ev->is_mus_type ("busy-playing-event"))
84 return note_evs_.size ();
89 #include "translator.icc"
91 ADD_TRANSLATOR (Drum_note_performer,
92 "Play drum notes.", "",
93 "note-event busy-playing-event", "", "");