- double next_tick = _last_tick + one_ppqn_in_frames(transport_frames);
- nframes_t next_tick_offset = nframes_t(next_tick) - transport_frames;
-
-#ifdef DEBUG_MIDI_CLOCK
- cerr << "Transport:" << transport_frames
- << ":Last tick time:" << _last_tick << ":"
- << ":Next tick time:" << next_tick << ":"
- << "Offset:" << next_tick_offset << ":"
- << "cycle length:" << _midi_port->nframes_this_cycle()
- << endl;
-#endif
-
- if (next_tick_offset >= _midi_port->nframes_this_cycle())
- return;
+ double next_tick = _last_tick + one_ppqn_in_frames (transport_frame);
+ frameoffset_t next_tick_offset = llrint (next_tick) - transport_frame;
+
+ MIDI::JackMIDIPort* mp = dynamic_cast<MIDI::JackMIDIPort*> (_midi_port);
+
+ /*
+ DEBUG_TRACE (PBD::DEBUG::MidiClock,
+ string_compose ("Transport: %1, last tick time: %2, next tick time: %3, offset: %4, cycle length: %5\n",
+ transport_frame, _last_tick, next_tick, next_tick_offset, mp ? mp->nframes_this_cycle() : 0));
+ */
+
+ if (!mp || (next_tick_offset >= mp->nframes_this_cycle())) {
+ break;
+ }