Fix timecode generation after split-cycles

This commit is contained in:
Robin Gareus 2019-11-03 14:42:10 +01:00
parent b412ca7215
commit e371e8a51a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 17 additions and 11 deletions

View File

@ -558,7 +558,7 @@ Session::send_midi_time_code_for_cycle (samplepos_t start_sample, samplepos_t en
assert (out_stamp < nframes);
MidiBuffer& mb (_midi_ports->mtc_output_port()->get_midi_buffer(nframes));
if (!mb.push_back (out_stamp, 2, mtc_msg)) {
if (!mb.push_back (Port::port_offset () + out_stamp, 2, mtc_msg)) {
error << string_compose(_("Session: cannot send quarter-frame MTC message (%1)"), strerror (errno))
<< endmsg;
return -1;

View File

@ -505,15 +505,15 @@ Session::process_with_events (pframes_t nframes)
return;
}
if (!_exporting && !timecode_transmission_suspended()) {
send_midi_time_code_for_cycle (_transport_sample, end_sample, nframes);
}
ltc_tx_send_time_code_for_cycle (_transport_sample, end_sample, _target_transport_speed, _transport_speed, nframes);
samplepos_t stop_limit = compute_stop_limit ();
if (maybe_stop (stop_limit)) {
if (!_exporting && !timecode_transmission_suspended()) {
send_midi_time_code_for_cycle (_transport_sample, end_sample, nframes);
}
ltc_tx_send_time_code_for_cycle (_transport_sample, end_sample, _target_transport_speed, _transport_speed, nframes);
no_roll (nframes);
return;
}
@ -544,6 +544,12 @@ Session::process_with_events (pframes_t nframes)
if (this_nframes) {
if (!_exporting && !timecode_transmission_suspended()) {
send_midi_time_code_for_cycle (_transport_sample, _transport_sample + samples_moved, this_nframes);
}
ltc_tx_send_time_code_for_cycle (_transport_sample, _transport_sample + samples_moved, _target_transport_speed, _transport_speed, this_nframes);
click (_transport_sample, this_nframes);
if (process_routes (this_nframes, session_needs_butler)) {

View File

@ -329,7 +329,7 @@ MidiClockTicker::send_midi_clock_event (pframes_t offset, pframes_t nframes)
static uint8_t msg = MIDI_CMD_COMMON_CLOCK;
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
mb.push_back (offset, 1, &msg);
mb.push_back (offset + Port::port_offset(), 1, &msg);
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Tick with offset %1\n", offset));
}
@ -343,7 +343,7 @@ MidiClockTicker::send_start_event (pframes_t offset, pframes_t nframes)
static uint8_t msg = { MIDI_CMD_COMMON_START };
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
mb.push_back (offset, 1, &msg);
mb.push_back (offset + Port::port_offset(), 1, &msg);
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Start %1\n", _last_tick));
}
@ -357,7 +357,7 @@ MidiClockTicker::send_continue_event (pframes_t offset, pframes_t nframes)
static uint8_t msg = { MIDI_CMD_COMMON_CONTINUE };
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
mb.push_back (offset, 1, &msg);
mb.push_back (offset + Port::port_offset(), 1, &msg);
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Continue %1\n", _last_tick));
}
@ -371,7 +371,7 @@ MidiClockTicker::send_stop_event (pframes_t offset, pframes_t nframes)
static uint8_t msg = MIDI_CMD_COMMON_STOP;
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
mb.push_back (offset, 1, &msg);
mb.push_back (offset + Port::port_offset(), 1, &msg);
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Stop %1\n", _last_tick));
}
@ -395,7 +395,7 @@ MidiClockTicker::send_position_event (uint32_t midi_beats, pframes_t offset, pfr
msg[2] = midi_beats >> 7;
MidiBuffer& mb (_midi_port->get_midi_buffer (nframes));
mb.push_back (offset, 3, &msg[0]);
mb.push_back (offset + Port::port_offset(), 3, &msg[0]);
DEBUG_TRACE (DEBUG::MidiClock, string_compose ("Song Position Sent: %1 to %2 (events now %3, buf = %4)\n", midi_beats, _midi_port->name(),
mb.size(), &mb));