mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-21 22:26:29 +01:00
nominal improvement for MTC master: use port latency to adjust sampletimes that MTC events "occured at"
This commit is contained in:
parent
1280360a65
commit
c56e99cd09
2 changed files with 19 additions and 0 deletions
|
|
@ -501,6 +501,9 @@ class LIBARDOUR_API MTC_TransportMaster : public TimecodeTransportMaster, public
|
||||||
void init_mtc_dll(samplepos_t, double);
|
void init_mtc_dll(samplepos_t, double);
|
||||||
void parse_timecode_offset();
|
void parse_timecode_offset();
|
||||||
void parameter_changed(std::string const & p);
|
void parameter_changed(std::string const & p);
|
||||||
|
|
||||||
|
void resync_latency();
|
||||||
|
LatencyRange mtc_slave_latency;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LIBARDOUR_API LTC_TransportMaster : public TimecodeTransportMaster {
|
class LIBARDOUR_API LTC_TransportMaster : public TimecodeTransportMaster {
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,10 @@ MTC_TransportMaster::MTC_TransportMaster (std::string const & name)
|
||||||
, printed_timecode_warning (false)
|
, printed_timecode_warning (false)
|
||||||
{
|
{
|
||||||
init ();
|
init ();
|
||||||
|
|
||||||
|
resync_latency();
|
||||||
|
|
||||||
|
AudioEngine::instance()->GraphReordered.connect_same_thread (port_connections, boost::bind (&MTC_TransportMaster::resync_latency, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
MTC_TransportMaster::~MTC_TransportMaster()
|
MTC_TransportMaster::~MTC_TransportMaster()
|
||||||
|
|
@ -88,6 +92,16 @@ MTC_TransportMaster::init ()
|
||||||
reset (true);
|
reset (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MTC_TransportMaster::resync_latency()
|
||||||
|
{
|
||||||
|
DEBUG_TRACE (DEBUG::MTC, "MTC resync_latency()\n");
|
||||||
|
|
||||||
|
if (_port) {
|
||||||
|
_port->get_connected_latency_range (mtc_slave_latency, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MTC_TransportMaster::create_port ()
|
MTC_TransportMaster::create_port ()
|
||||||
{
|
{
|
||||||
|
|
@ -129,6 +143,8 @@ MTC_TransportMaster::pre_process (MIDI::pframes_t nframes, samplepos_t now, boos
|
||||||
|
|
||||||
maybe_reset ();
|
maybe_reset ();
|
||||||
|
|
||||||
|
now -= mtc_slave_latency.max;
|
||||||
|
|
||||||
_midi_port->read_and_parse_entire_midi_buffer_with_no_speed_adjustment (nframes, parser, now);
|
_midi_port->read_and_parse_entire_midi_buffer_with_no_speed_adjustment (nframes, parser, now);
|
||||||
|
|
||||||
if (session_pos) {
|
if (session_pos) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue