25 : _sample_rate (sample_rate)
26 , _monotonic_cnt (sample_rate)
27 , _last_signal_tme (0)
30 , _min_delay (INT32_MAX)
43 #define MODCLK (16384) // 1<<(2*7)
45 const int64_t ti = ((buf[2] & 0x7f) << 7) | (buf[1] & 0x7f);
48 printf(
"MCLK DELAY: #%5"PRId64
" dt:%6"PRId64
" [spl] (%6"PRId64
" - %8"PRId64
") @(%8"PRId64
" + %d)\n",
57 #define MODTC (2097152) // 1<<(3*7)
59 const int64_t ti = (buf[5] & 0x7f)
60 | ((buf[6] & 0x7f) << 7)
61 | ((buf[7] & 0x7f) << 14)
62 | ((buf[8] & 0x7f) << 21);
63 const int64_t tdiff = (
MODTC + tc - ti) %
MODTC;
65 printf(
"MTC DELAY: #%5"PRId64
" dt:%6"PRId64
" [spl] (%6"PRId64
" - %8"PRId64
") @(%8"PRId64
" + %d)\n",
75 #ifndef USE_MTC // use 3-byte song position
81 #else // sysex MTC frame
99 printf(
"MIDI SEND: @%8"PRId64
", recv: %d systime:%"PRId64
"\n",
_monotonic_cnt, nevents, g_get_monotonic_time());
101 for (
pframes_t n = 0; n < nevents; ++n) {
108 if (size == 3 && buf[0] == 0xf2 )
111 }
else if (size == 10 && buf[0] == 0xf0)
126 const double var_m1 =
_var_m;
virtual void midi_clear(void *port_buffer)=0
MIDIDM(framecnt_t sample_rate)
int process(pframes_t nframes, PortEngine &pe, void *midi_in, void *midi_out)
uint64_t _last_signal_tme
int64_t parse_mclk(uint8_t *buf, pframes_t timestamp) const
int64_t parse_mtc(uint8_t *buf, pframes_t timestamp) const
virtual uint32_t get_midi_event_count(void *port_buffer)=0
virtual int midi_event_get(pframes_t ×tamp, size_t &size, uint8_t **buf, void *port_buffer, uint32_t event_index)=0
virtual int midi_event_put(void *port_buffer, pframes_t timestamp, const uint8_t *buffer, size_t size)=0