+class LIBARDOUR_API AsyncMIDIPort : public ARDOUR::MidiPort, public MIDI::Port {
+
+ public:
+ AsyncMIDIPort (std::string const &, PortFlags);
+ ~AsyncMIDIPort ();
+
+ bool flush_at_cycle_start () const { return _flush_at_cycle_start; }
+ void set_flush_at_cycle_start (bool en) { _flush_at_cycle_start = en; }
+
+ /* called from an RT context */
+ void cycle_start (pframes_t nframes);
+ void cycle_end (pframes_t nframes);
+
+ /* called from non-RT context */
+ void parse (samplecnt_t timestamp);
+ int write (const MIDI::byte *msg, size_t msglen, MIDI::timestamp_t timestamp);
+ int read (MIDI::byte *buf, size_t bufsize);
+ /* waits for output to be cleared */
+ void drain (int check_interval_usecs, int total_usecs_to_wait);
+
+ /* clears async request communication channel */
+ void clear () {
+ _xthread.drain ();
+ }
+
+ CrossThreadChannel& xthread() {
+ return _xthread;
+ }
+
+ /* Not selectable; use ios() */
+ int selectable() const { return -1; }
+ void set_timer (boost::function<samplecnt_t (void)>&);