]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/midi-walker.hh
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / include / midi-walker.hh
1 /*
2   midi-walker.hh -- declare Midi_walker
3
4   (c) 1996--2006 Han-Wen Nienhuys  <hanwen@xs4all.nl>
5   Jan Nieuwenhuizen <janneke@gnu.org>
6 */
7
8 #ifndef MIDI_WALKER_HH
9 #define MIDI_WALKER_HH
10
11 #include "pqueue.hh"
12 #include "lily-proto.hh"
13 #include "moment.hh"
14
15 struct Midi_note_event : PQueue_ent<Moment, Midi_note *>
16 {
17   bool ignore_b_;
18   Midi_note_event ();
19 };
20
21 int compare (Midi_note_event const &left, Midi_note_event const &right);
22
23 /**
24    walk audio and output midi
25 */
26 class Midi_walker
27 {
28 public:
29   Midi_walker (Audio_staff *audio_staff, Midi_track *midi_track);
30   ~Midi_walker ();
31
32   void process ();
33   void operator ++ (int);
34   bool ok () const;
35
36 private:
37   void do_start_note (Midi_note *note);
38   void do_stop_notes (Moment now_mom);
39   void output_event (Moment now_mom, Midi_item *l);
40
41   Midi_track *track_;
42   Audio_staff *staff_;
43   vsize index_;
44   vector<Audio_item*> *items_;
45   PQueue<Midi_note_event> stop_note_queue;
46   Moment last_mom_;
47 };
48
49 #endif // MIDI_WALKER_HH