using namespace ARDOUR;
-MIDIDM::MIDIDM (framecnt_t sample_rate)
+MIDIDM::MIDIDM (samplecnt_t sample_rate)
: _sample_rate (sample_rate)
, _monotonic_cnt (sample_rate)
, _last_signal_tme (0)
}
int64_t
-MIDIDM::parse_mclk (uint8_t* buf, pframes_t timestamp) const
+MIDIDM::parse_mclk (uint8_t const * const buf, pframes_t timestamp) const
{
/* calculate time difference */
#define MODCLK (16384) // 1<<(2*7)
const int64_t ti = ((buf[2] & 0x7f) << 7) | (buf[1] & 0x7f);
const int64_t tdiff = (MODCLK + tc - ti) % MODCLK;
#ifdef DEBUG_MIDIDM
- printf("MCLK DELAY: # %5"PRId64" %5"PRId64" [samples] (%5"PRId64" - %8"PRId64") @(%5"PRId64" + %d)\n",
+ printf("MCLK DELAY: #%5"PRId64" dt:%6"PRId64" [spl] (%6"PRId64" - %8"PRId64") @(%8"PRId64" + %d)\n",
_cnt_total, tdiff, tc, ti, _monotonic_cnt, timestamp);
#endif
return tdiff;
}
int64_t
-MIDIDM::parse_mtc (uint8_t* buf, pframes_t timestamp) const
+MIDIDM::parse_mtc (uint8_t const * const buf, pframes_t timestamp) const
{
#define MODTC (2097152) // 1<<(3*7)
const int64_t tc = (_monotonic_cnt + timestamp) & 0x001FFFFF;
| ((buf[8] & 0x7f) << 21);
const int64_t tdiff = (MODTC + tc - ti) % MODTC;
#ifdef DEBUG_MIDIDM
- printf("MTC DELAY: # %5"PRId64" %5"PRId64" [samples] (%5"PRId64" - %8"PRId64") @(%5"PRId64" + %d)\n",
+ printf("MTC DELAY: #%5"PRId64" dt:%6"PRId64" [spl] (%6"PRId64" - %8"PRId64") @(%8"PRId64" + %d)\n",
_cnt_total, tdiff, tc, ti, _monotonic_cnt, timestamp);
#endif
return tdiff;
obuf[1] = (_monotonic_cnt) & 0x7f;
obuf[2] = (_monotonic_cnt >> 7) & 0x7f;
pe.midi_event_put (midi_out, 0, obuf, 3);
-#else // sysex MTC frame
- uint8_t obuf[9];
+#else // sysex MTC sample
+ uint8_t obuf[10];
obuf[0] = 0xf0;
obuf[1] = 0x7f;
obuf[2] = 0x7f;
for (pframes_t n = 0; n < nevents; ++n) {
pframes_t timestamp;
size_t size;
- uint8_t* buf;
+ uint8_t const* buf;
int64_t tdiff;
pe.midi_event_get (timestamp, size, &buf, midi_in, n);