|
@@ -10,6 +10,7 @@
|
10
|
10
|
#include "cmCtx.h"
|
11
|
11
|
#include "cmMem.h"
|
12
|
12
|
#include "cmMallocDebug.h"
|
|
13
|
+#include "cmTime.h"
|
13
|
14
|
#include "cmMidi.h"
|
14
|
15
|
#include "cmMidiPort.h"
|
15
|
16
|
|
|
@@ -507,7 +508,7 @@ void _cmMpMIDISystemReadProc( const MIDIPacketList *pktListPtr, void* readProcRe
|
507
|
508
|
|
508
|
509
|
double nano = 1e-9 * ( (double) _cmMpRoot.timeBaseInfo.numer) / ((double) _cmMpRoot.timeBaseInfo.denom);
|
509
|
510
|
|
510
|
|
- // so here's the delta in nanoseconds:
|
|
511
|
+ // so here's the timestamp in nanoseconds:
|
511
|
512
|
double nanoSeconds = ((double) packetPtr->timeStamp) * nano;
|
512
|
513
|
|
513
|
514
|
// 1000 times that for microSeconds:
|
|
@@ -516,13 +517,17 @@ void _cmMpMIDISystemReadProc( const MIDIPacketList *pktListPtr, void* readProcRe
|
516
|
517
|
// BUG BUG BUG: How can multiplying the nanoseconds produce microseconds?
|
517
|
518
|
// Shouldn't the nano to micro conversion be a divide?
|
518
|
519
|
|
519
|
|
- double deltaMicroSecs = microSecs - pp->prevMicroSecs;
|
|
520
|
+ //double deltaMicroSecs = microSecs - pp->prevMicroSecs;
|
520
|
521
|
|
521
|
522
|
pp->prevMicroSecs = microSecs;
|
522
|
523
|
|
|
524
|
+ cmTimeSpec_t ts;
|
|
525
|
+ ts.tv_sec = floor(microSecs / 1000000.0);
|
|
526
|
+ ts.tv_nsec = (microSecs - ts.tv_sec * 1000000.0) * 1000.0;
|
|
527
|
+
|
523
|
528
|
assert( pp->inputFl == true );
|
524
|
529
|
|
525
|
|
- cmMpParseMidiData( pp->parserH, (unsigned)deltaMicroSecs, packetPtr->data, packetPtr->length );
|
|
530
|
+ cmMpParseMidiData( pp->parserH, &ts, packetPtr->data, packetPtr->length );
|
526
|
531
|
|
527
|
532
|
packetPtr = MIDIPacketNext(packetPtr);
|
528
|
533
|
}
|