X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fmidi-walker.hh;h=2ee7cc941797ce75cbbc55d53663f21bab695ead;hb=2f38710a2b40a24977441aa7faa05b6ab132f3cf;hp=dea2478d24006fe5d38b9570c995d35bdd837dda;hpb=b17fe8f245d6eab3eb1c8d66ee8a6f7acb94f85e;p=lilypond.git diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index dea2478d24..2ee7cc9417 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -1,82 +1,53 @@ /* midi-walker.hh -- declare Midi_walker - (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen - */ + (c) 1996--2009 Han-Wen Nienhuys + Jan Nieuwenhuizen +*/ -#ifndef MIDIWALKER_HH -#define MIDIWALKER_HH +#ifndef MIDI_WALKER_HH +#define MIDI_WALKER_HH - -#include "lily-proto.hh" - -#if 0 - -// sketch. . . -class Midi_register { -}; - -class Midi_group_reg : public Midi_register, public Acceptor { - -}; - -class Midi_staff_reg : public Midi_group_reg { -}; - - -class Midi_note_reg : public Midi_register { - -}; - -class Midi_voice_reg : public Midi_group_reg, public Interpreter { - -}; - -class Midi_score_reg: public Midi_group_reg, public Global_acceptor { -}; - - -#include "grouping.hh" -#include "staff-walker.hh" -#include "pcursor.hh" #include "pqueue.hh" +#include "lily-proto.hh" +#include "moment.hh" - -struct Note_event : PQueue_ent +struct Midi_note_event : PQueue_ent { - bool ignore_b_; - Note_event() { - ignore_b_ = false; - } + bool ignore_; + Midi_note_event (); }; -int compare(Note_event const&, Note_event const&); +int compare (Midi_note_event const &left, Midi_note_event const &right); /** - a simple walker which collects midi stuff, and then outputs. - - Should derive from Staff_walker - */ -class Midi_walker : public PCursor + walk audio and output midi +*/ +class Midi_walker { - Midi_track *track_l_; - - PQueue< Note_event > stop_notes; - - Moment last_moment_; - - /* *************** */ - void do_stop_notes(Moment); - void do_start_note(Note_req *note_l); - void output_event(Midi_item&, Moment); public: - - Midi_walker(Staff*, Midi_track*); - void do_process_requests(); - ~Midi_walker(); -}; -#endif - -#endif // MIDIWALKER_HH - - + Midi_walker (Audio_staff *audio_staff, Midi_track *midi_track, + int channel); + ~Midi_walker (); + + void process (); + void operator ++ (int); + bool ok () const; + void finalize (); +private: + void do_start_note (Midi_note *note); + void do_stop_notes (int); + void output_event (int, Midi_item *l); + Midi_item *get_midi (Audio_item*); + int channel_; + Midi_track *track_; + Audio_staff *staff_; + vsize index_; + vector items_; + PQueue stop_note_queue; + int last_tick_; + + vector midi_events_; +}; + +#endif // MIDI_WALKER_HH