add missing extra file
[ardour.git] / libs / ardour / async_midi_port.cc
index 77ca62961e9124d780c9ecaa6b3dca0f023ab0a4..bd583328c30f1781a768d3268f27c1053bb64265 100644 (file)
@@ -19,6 +19,9 @@
 */
 
 #include <iostream>
+#include <vector>
+
+#include <glibmm/timer.h>
 
 #include "pbd/error.h"
 #include "pbd/stacktrace.h"
@@ -49,7 +52,9 @@ AsyncMIDIPort::AsyncMIDIPort (string const & name, PortFlags flags)
        , _last_write_timestamp (0)
        , output_fifo (512)
        , input_fifo (1024)
+#ifndef PLATFORM_WINDOWS
        , xthread (true)
+#endif
 {
 }
 
@@ -58,7 +63,7 @@ AsyncMIDIPort::~AsyncMIDIPort ()
 }
 
 void
-AsyncMIDIPort::flush_output_fifo (pframes_t nframes)
+AsyncMIDIPort::flush_output_fifo (MIDI::pframes_t nframes)
 {
        RingBuffer< Evoral::Event<double> >::rw_vector vec = { { 0, 0 }, { 0, 0 } };
        size_t written;
@@ -89,7 +94,7 @@ AsyncMIDIPort::flush_output_fifo (pframes_t nframes)
 }
 
 void
-AsyncMIDIPort::cycle_start (pframes_t nframes)
+AsyncMIDIPort::cycle_start (MIDI::pframes_t nframes)
 {
        _currently_in_cycle = true;
        MidiPort::cycle_start (nframes);
@@ -113,16 +118,17 @@ AsyncMIDIPort::cycle_start (pframes_t nframes)
                for (MidiBuffer::iterator b = mb.begin(); b != mb.end(); ++b) {
                        input_fifo.write (when, (Evoral::EventType) 0, (*b).size(), (*b).buffer());
                }
-               
+
+#ifndef PLATFORM_WINDOWS
                if (!mb.empty()) {
                        xthread.wakeup ();
                }
+#endif
        }
-
 }
 
 void
-AsyncMIDIPort::cycle_end (pframes_t nframes)
+AsyncMIDIPort::cycle_end (MIDI::pframes_t nframes)
 {
        if (ARDOUR::Port::sends_output()) {
                /* move any additional data from output FIFO into the port
@@ -161,7 +167,7 @@ AsyncMIDIPort::drain (int check_interval_usecs)
                if (vec.len[0] + vec.len[1] >= output_fifo.bufsize() - 1) {
                        break;
                }
-               usleep (check_interval_usecs);
+               Glib::usleep (check_interval_usecs);
        }
 }
 
@@ -268,9 +274,9 @@ AsyncMIDIPort::read (MIDI::byte *, size_t)
        timestamp_t time;
        Evoral::EventType type;
        uint32_t size;
-       MIDI::byte buffer[input_fifo.capacity()];
+       vector<MIDI::byte> buffer(input_fifo.capacity());
 
-       while (input_fifo.read (&time, &type, &size, buffer)) {
+       while (input_fifo.read (&time, &type, &size, &buffer[0])) {
                _parser->set_timestamp (time);
                for (uint32_t i = 0; i < size; ++i) {
                        _parser->scanner (buffer[i]);
@@ -281,7 +287,7 @@ AsyncMIDIPort::read (MIDI::byte *, size_t)
 }
 
 void
-AsyncMIDIPort::parse (framecnt_t)
+AsyncMIDIPort::parse (MIDI::framecnt_t)
 {
        MIDI::byte buf[1];