Amend f301e692a
: expose compensated port-latency
Retain min/max when copying inherited latency from connected ports. When there is a direct connection port A out -> port B in, min/max latency range should be retained in direction of signal flow. Ardour can only adjust latency in reverse direction of signal flow to match min = max with an internal delay-line. ie set playback latency of an input port, or capture latency of an output port.
This commit is contained in:
parent
a84cb976a0
commit
4998b2711b
@ -124,6 +124,7 @@ public:
|
||||
|
||||
void set_private_port_latencies (samplecnt_t value, bool playback);
|
||||
void set_public_port_latencies (samplecnt_t value, bool playback) const;
|
||||
void set_public_port_latency_from_connections () const;
|
||||
|
||||
PortSet& ports() { return _ports; }
|
||||
const PortSet& ports() const { return _ports; }
|
||||
|
@ -1261,6 +1261,33 @@ IO::set_private_port_latencies (samplecnt_t value, bool playback)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
IO::set_public_port_latency_from_connections () const
|
||||
{
|
||||
/* get min/max of connected up/downstream ports */
|
||||
bool connected = false;
|
||||
bool playback = _direction == Output;
|
||||
LatencyRange lr;
|
||||
lr.min = ~((pframes_t) 0);
|
||||
lr.max = 0;
|
||||
|
||||
for (PortSet::const_iterator i = _ports.begin(); i != _ports.end(); ++i) {
|
||||
if (i->connected()) {
|
||||
connected = true;
|
||||
}
|
||||
i->collect_latency_from_backend (lr, playback);
|
||||
}
|
||||
|
||||
if (!connected) {
|
||||
/* if output is not connected to anything, use private latency */
|
||||
lr.min = lr.max = latency ();
|
||||
}
|
||||
|
||||
for (PortSet::const_iterator i = _ports.begin (); i != _ports.end(); ++i) {
|
||||
i->set_public_latency_range (lr, playback);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
IO::set_public_port_latencies (samplecnt_t value, bool playback) const
|
||||
{
|
||||
|
@ -5002,17 +5002,17 @@ Route::set_public_port_latencies (samplecnt_t value, bool playback, bool with_la
|
||||
* latency compensation into account.
|
||||
*/
|
||||
if (playback) {
|
||||
_output->set_public_port_latencies (_output->latency (), playback);
|
||||
_output->set_public_port_latency_from_connections ();
|
||||
if (_delayline && with_latcomp) {
|
||||
value += _delayline->delay ();
|
||||
}
|
||||
_input->set_public_port_latencies (value, playback);
|
||||
_input->set_public_port_latencies (value, true);
|
||||
} else {
|
||||
_input->set_public_port_latencies (_input->latency(), playback);
|
||||
_input->set_public_port_latency_from_connections ();
|
||||
if (_delayline && with_latcomp) {
|
||||
value += _delayline->delay ();
|
||||
}
|
||||
_output->set_public_port_latencies (value, playback);
|
||||
_output->set_public_port_latencies (value, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user