summaryrefslogtreecommitdiff
path: root/libs/ardour/ticker.cc
diff options
context:
space:
mode:
authorMichael Fisher <mfisher31@gmail.com>2013-08-01 10:07:18 -0500
committerMichael Fisher <mfisher31@gmail.com>2013-08-02 08:59:32 -0500
commit18490878b402d3f86b48c3f4e3c45c7fdeb1c9a3 (patch)
tree1969b5f118012babb170ebe684dbd05553403cc2 /libs/ardour/ticker.cc
parent27a7bd0f1298b67681242e8ffe20bfccce34567f (diff)
WIP - Experimenting with an alternative clock generating algo
- Transport debug output (tracing where transport_frame is updated
Diffstat (limited to 'libs/ardour/ticker.cc')
-rw-r--r--libs/ardour/ticker.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/libs/ardour/ticker.cc b/libs/ardour/ticker.cc
index c252bc6cf7..c74f40c78e 100644
--- a/libs/ardour/ticker.cc
+++ b/libs/ardour/ticker.cc
@@ -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;
}
+ double iter = _last_tick;
+ double clock_delta = one_ppqn_in_frames (transport_frame);
+
while (true) {
- double next_tick = _last_tick + one_ppqn_in_frames (transport_frame);
+ 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