]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/midi-walker.hh
release: 0.1.7
[lilypond.git] / lily / include / midi-walker.hh
1 /*
2   midi-walker.hh -- declare Midi_walker
3
4   (c) 1996, 1997 Han-Wen Nienhuys  <hanwen@stack.nl>
5                  Jan Nieuwenhuizen <jan@digicash.com>
6  */
7
8 #ifndef MIDI_WALKER_HH
9 #define MIDI_WALKER_HH
10
11 #include "proto.hh"
12 #include "plist.hh"
13 #include "pcursor.hh"
14 #include "pqueue.hh"
15 #include "lily-proto.hh"
16 #include "moment.hh"
17
18 struct Midi_note_event : PQueue_ent<Moment, Midi_note_off*>
19 {
20     bool ignore_b_;
21     Midi_note_event();
22 };
23
24 int compare(Midi_note_event const& left, Midi_note_event const& right );
25
26 /**
27   walk audio and output midi
28   */
29 class Midi_walker : public PCursor<Audio_item*> 
30 {
31 public:
32     Midi_walker( Audio_staff* audio_staff_l, Midi_track* midi_track_l );
33     ~Midi_walker();
34
35     void process();
36
37 private:
38     void do_start_note( Midi_note* note_l );
39     void do_stop_notes( Moment now_mom );
40     void output_event( Moment now_mom, Midi_item* l );
41
42     Midi_track* track_l_;
43     PQueue<Midi_note_event> stop_note_queue;
44     Moment last_mom_;
45 };
46
47
48 #endif // MIDI_WALKER_HH