X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Finclude%2Fmidi-walker.hh;h=bc12bb9aa68cc00c76bfa69ebc6765fd5e8f3b81;hb=03f6455a0f48b59f3efe77a553ce036015aa3034;hp=dea2478d24006fe5d38b9570c995d35bdd837dda;hpb=b17fe8f245d6eab3eb1c8d66ee8a6f7acb94f85e;p=lilypond.git diff --git a/lily/include/midi-walker.hh b/lily/include/midi-walker.hh index dea2478d24..bc12bb9aa6 100644 --- a/lily/include/midi-walker.hh +++ b/lily/include/midi-walker.hh @@ -1,82 +1,51 @@ /* midi-walker.hh -- declare Midi_walker - (c) 1996,97 Han-Wen Nienhuys, Jan Nieuwenhuizen - */ + (c) 1996--2007 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_b_; + 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 + Midi_walker (Audio_staff *audio_staff, Midi_track *midi_track, + int channel); + ~Midi_walker (); + + void process (); + void operator ++ (int); + bool ok () const; -#endif // MIDIWALKER_HH +private: + void do_start_note (Midi_note *note); + void do_stop_notes (Moment now_mom); + void output_event (Moment now_mom, Midi_item *l); + int channel_; + Midi_track *track_; + Audio_staff *staff_; + vsize index_; + vector *items_; + PQueue stop_note_queue; + Moment last_mom_; +}; +#endif // MIDI_WALKER_HH