13
0

WIP - Experimenting with an alternative clock generating algo

- Transport debug output (tracing where transport_frame
      is updated
This commit is contained in:
Michael Fisher 2013-08-01 10:07:18 -05:00 committed by Paul Davis
parent 9592359c70
commit 46ee815459
2 changed files with 15 additions and 7 deletions

View File

@ -384,6 +384,7 @@ Session::butler_transport_work ()
g_atomic_int_dec_and_test (&_butler->should_do_transport_work);
DEBUG_TRACE (DEBUG::Transport, X_("Butler transport work all done\n"));
DEBUG_TRACE (DEBUG::Transport, X_(string_compose ("Frame %1\n", _transport_frame)));
}
void
@ -1007,6 +1008,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
send_mmc_locate (_transport_frame);
}
_last_roll_location = _last_roll_or_reversal_location = _transport_frame;
Located (); /* EMIT SIGNAL */
}

View File

@ -126,6 +126,8 @@ MidiClockTicker::set_session (Session* s)
}
}
static bool need_reset = false;
void
MidiClockTicker::session_located()
{
@ -136,6 +138,7 @@ MidiClockTicker::session_located()
}
_last_tick = _pos->frame;
need_reset = true;
if (_pos->speed == 0.0f && Config->get_send_midi_clock()) {
uint32_t where = std::floor (_pos->midi_beats);
@ -253,34 +256,37 @@ MidiClockTicker::transport_looped()
void
MidiClockTicker::tick (const framepos_t& transport_frame)
{
if (!Config->get_send_midi_clock() || _session == 0 || _session->transport_speed() != 1.0f || _midi_port == 0) {
return;
}
while (true) {
double next_tick = _last_tick + one_ppqn_in_frames (transport_frame);
frameoffset_t next_tick_offset = llrint (next_tick) - transport_frame;
double iter = _last_tick;
double clock_delta = one_ppqn_in_frames (transport_frame);
while (true) {
double next_tick = iter + clock_delta;
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;
return;
}
if (next_tick_offset >= 0) {
send_midi_clock_event (next_tick_offset);
_last_tick += clock_delta;
}
_pos->frame = _last_tick = next_tick;
iter = next_tick;
}
_pos->frame = _last_tick;
}
double