Prepare timecode-generator direct-out

Generator ports (like TransportMaster slaves), should not be
re-sampled when vari-speeding. Instead the Timecode/Clock should
directly use the engine-speed.

For this to happen, they need to be special-cased: no re-sampler
latency, direct access to engine-buffers.
This commit is contained in:
Robin Gareus 2020-05-07 17:22:40 +02:00
parent 9604e64c35
commit d9caa7fd9a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 15 additions and 12 deletions

View File

@ -735,7 +735,10 @@ enum PortFlags {
/* non-JACK related flags */ /* non-JACK related flags */
Hidden = 0x20, Hidden = 0x20,
Shadow = 0x40, Shadow = 0x40,
TransportMasterPort = 0x80
TransportMasterPort = 0x80, // incoming data, used by slaves
TransportGenerator = 0x100, // outgoing, timecode/clock generators
TransportSyncPort = 0x180 // = TransportMasterPort | TransportGenerator
}; };
enum MidiPortFlags { enum MidiPortFlags {

View File

@ -136,7 +136,7 @@ AudioPort::get_audio_buffer (pframes_t nframes)
Sample* addr; Sample* addr;
if (!externally_connected ()) { if (!externally_connected () || 0 != (flags() & TransportSyncPort)) {
addr = (Sample *) port_engine.get_buffer (_port_handle, nframes); addr = (Sample *) port_engine.get_buffer (_port_handle, nframes);
} else { } else {
/* _data was read and resampled as necessary in ::cycle_start */ /* _data was read and resampled as necessary in ::cycle_start */

View File

@ -370,7 +370,7 @@ Port::set_public_latency_range (LatencyRange const& range, bool playback) const
if (_port_handle) { if (_port_handle) {
LatencyRange r (range); LatencyRange r (range);
if (externally_connected () && 0 == (_flags & TransportMasterPort)) { if (externally_connected () && 0 == (_flags & TransportSyncPort)) {
#if 0 #if 0
r.min *= _speed_ratio; r.min *= _speed_ratio;
r.max *= _speed_ratio; r.max *= _speed_ratio;
@ -436,7 +436,7 @@ Port::public_latency_range (bool /*playback*/) const
if (_port_handle) { if (_port_handle) {
r = port_engine.get_latency_range (_port_handle, sends_output() ? true : false); r = port_engine.get_latency_range (_port_handle, sends_output() ? true : false);
if (externally_connected () && 0 == (_flags & TransportMasterPort)) { if (externally_connected () && 0 == (_flags & TransportSyncPort)) {
#if 0 #if 0
r.min /= _speed_ratio; r.min /= _speed_ratio;
r.max /= _speed_ratio; r.max /= _speed_ratio;
@ -485,7 +485,7 @@ Port::get_connected_latency_range (LatencyRange& range, bool playback) const
if (remote_port) { if (remote_port) {
lr = port_engine.get_latency_range (remote_port, playback); lr = port_engine.get_latency_range (remote_port, playback);
if (externally_connected () && 0 == (_flags & TransportMasterPort)) { if (externally_connected () && 0 == (_flags & TransportSyncPort)) {
#if 0 #if 0
lr.min /= _speed_ratio; lr.min /= _speed_ratio;
lr.max /= _speed_ratio; lr.max /= _speed_ratio;

View File

@ -395,7 +395,7 @@ PortManager::register_port (DataType dtype, const string& portname, bool input,
/* limit the possible flags that can be set */ /* limit the possible flags that can be set */
flags = PortFlags (flags & (Hidden|Shadow|IsTerminal|TransportMasterPort)); flags = PortFlags (flags & (Hidden|Shadow|IsTerminal|TransportSyncPort));
try { try {
if (dtype == DataType::AUDIO) { if (dtype == DataType::AUDIO) {
@ -809,14 +809,14 @@ PortManager::cycle_start (pframes_t nframes, Session* s)
if (s && s->rt_tasklist () && fabs (Port::speed_ratio ()) != 1.0) { if (s && s->rt_tasklist () && fabs (Port::speed_ratio ()) != 1.0) {
RTTaskList::TaskList tl; RTTaskList::TaskList tl;
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
if (!(p->second->flags() & TransportMasterPort)) { if (!(p->second->flags() & TransportSyncPort)) {
tl.push_back (boost::bind (&Port::cycle_start, p->second, nframes)); tl.push_back (boost::bind (&Port::cycle_start, p->second, nframes));
} }
} }
s->rt_tasklist()->process (tl); s->rt_tasklist()->process (tl);
} else { } else {
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
if (!(p->second->flags() & TransportMasterPort)) { if (!(p->second->flags() & TransportSyncPort)) {
p->second->cycle_start (nframes); p->second->cycle_start (nframes);
} }
} }
@ -830,14 +830,14 @@ PortManager::cycle_end (pframes_t nframes, Session* s)
if (0 && s && s->rt_tasklist () && fabs (Port::speed_ratio ()) != 1.0) { if (0 && s && s->rt_tasklist () && fabs (Port::speed_ratio ()) != 1.0) {
RTTaskList::TaskList tl; RTTaskList::TaskList tl;
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
if (!(p->second->flags() & TransportMasterPort)) { if (!(p->second->flags() & TransportSyncPort)) {
tl.push_back (boost::bind (&Port::cycle_end, p->second, nframes)); tl.push_back (boost::bind (&Port::cycle_end, p->second, nframes));
} }
} }
s->rt_tasklist()->process (tl); s->rt_tasklist()->process (tl);
} else { } else {
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
if (!(p->second->flags() & TransportMasterPort)) { if (!(p->second->flags() & TransportSyncPort)) {
p->second->cycle_end (nframes); p->second->cycle_end (nframes);
} }
} }
@ -939,14 +939,14 @@ PortManager::cycle_end_fade_out (gain_t base_gain, gain_t gain_step, pframes_t n
if (0 && s && s->rt_tasklist () && fabs (Port::speed_ratio ()) != 1.0) { if (0 && s && s->rt_tasklist () && fabs (Port::speed_ratio ()) != 1.0) {
RTTaskList::TaskList tl; RTTaskList::TaskList tl;
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
if (!(p->second->flags() & TransportMasterPort)) { if (!(p->second->flags() & TransportSyncPort)) {
tl.push_back (boost::bind (&Port::cycle_end, p->second, nframes)); tl.push_back (boost::bind (&Port::cycle_end, p->second, nframes));
} }
} }
s->rt_tasklist()->process (tl); s->rt_tasklist()->process (tl);
} else { } else {
for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) { for (Ports::iterator p = _cycle_ports->begin(); p != _cycle_ports->end(); ++p) {
if (!(p->second->flags() & TransportMasterPort)) { if (!(p->second->flags() & TransportSyncPort)) {
p->second->cycle_end (nframes); p->second->cycle_end (nframes);
} }
} }