summaryrefslogtreecommitdiff
path: root/libs/backends
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-10-19 19:10:18 +0200
committerRobin Gareus <robin@gareus.org>2016-10-19 19:45:53 +0200
commit56711b99c95536acf73457592768ebd91083d780 (patch)
tree0e09899357bbe6a33d9a6c6657bd50d1449e010b /libs/backends
parent3fa9dd51b2c4b5de39c73e1882d9b072338d8aaf (diff)
Work around OSX MIDI devices that send no timestamps
Diffstat (limited to 'libs/backends')
-rw-r--r--libs/backends/coreaudio/coremidi_io.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/libs/backends/coreaudio/coremidi_io.cc b/libs/backends/coreaudio/coremidi_io.cc
index caf80105b0..9d462aa10f 100644
--- a/libs/backends/coreaudio/coremidi_io.cc
+++ b/libs/backends/coreaudio/coremidi_io.cc
@@ -268,13 +268,21 @@ CoreMidiIo::recv_event (uint32_t port, double cycle_time_us, uint64_t &time, uin
if ((*it)->timeStamp < end) {
if ((*it)->timeStamp < start) {
uint64_t dt = AudioConvertHostTimeToNanos(start - (*it)->timeStamp);
- if (dt > 1e7) { // 10ms,
+ if (dt > 1e7 && (*it)->timeStamp != 0) { // 10ms slack and a timestamp is given
#ifndef NDEBUG
printf("Dropped Stale Midi Event. dt:%.2fms\n", dt * 1e-6);
#endif
it = _input_queue[port].erase(it);
continue;
} else {
+ /* events without a valid timestamp, or events that arrived
+ * less than 10ms in the past are allowed and
+ * queued at the beginning of the cycle:
+ * time (relative to cycle start) = 0
+ *
+ * The latter use needed for the "Avid Artist" Control Surface
+ * the OSX driver sends no timestamps.
+ */
#if 0
printf("Stale Midi Event. dt:%.2fms\n", dt * 1e-6);
#endif