X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fport_insert.cc;h=ce34048dde05737da28c4422ed942946e8bea5c5;hb=f269e39115934c8e48dbc66e495d8cfdba1e70f0;hp=b2758b2d57249353dd7755d4c4b4df9b1ca10dc6;hpb=7169c77cfc5a45ec29dcb58a251feccba5ac6b62;p=ardour.git diff --git a/libs/ardour/port_insert.cc b/libs/ardour/port_insert.cc index b2758b2d57..ce34048dde 100644 --- a/libs/ardour/port_insert.cc +++ b/libs/ardour/port_insert.cc @@ -49,7 +49,7 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr pannable, boost: { _mtdm = 0; _latency_detect = false; - _latency_flush_frames = false; + _latency_flush_frames = 0; _measured_latency = 0; } @@ -59,12 +59,19 @@ PortInsert::~PortInsert () delete _mtdm; } +void +PortInsert::set_pre_fader (bool p) +{ + Processor::set_pre_fader (p); + _out->set_pre_fader (p); +} + void PortInsert::start_latency_detection () { delete _mtdm; _mtdm = new MTDM (_session.frame_rate()); - _latency_flush_frames = false; + _latency_flush_frames = 0; _latency_detect = true; _measured_latency = 0; } @@ -72,7 +79,7 @@ PortInsert::start_latency_detection () void PortInsert::stop_latency_detection () { - _latency_flush_frames = signal_latency() + _session.engine().frames_per_cycle(); + _latency_flush_frames = signal_latency() + _session.engine().samples_per_cycle(); _latency_detect = false; } @@ -93,7 +100,7 @@ PortInsert::latency() const */ if (_measured_latency == 0) { - return _session.engine().frames_per_cycle() + _input->latency(); + return _session.engine().samples_per_cycle() + _input->latency(); } else { return _measured_latency; } @@ -115,8 +122,7 @@ PortInsert::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, Sample* out = outbuf.data(); _mtdm->process (nframes, in, out); - - outbuf.set_is_silent (false); + outbuf.set_written (true); } @@ -166,10 +172,10 @@ PortInsert::state (bool full) node.add_property ("type", "port"); snprintf (buf, sizeof (buf), "%" PRIu32, _bitslot); node.add_property ("bitslot", buf); - snprintf (buf, sizeof (buf), "%" PRId64, _measured_latency); - node.add_property("latency", buf); - snprintf (buf, sizeof (buf), "%u", _session.get_block_size()); - node.add_property("block_size", buf); + snprintf (buf, sizeof (buf), "%" PRId64, _measured_latency); + node.add_property("latency", buf); + snprintf (buf, sizeof (buf), "%u", _session.get_block_size()); + node.add_property("block-size", buf); return node; } @@ -204,17 +210,17 @@ PortInsert::set_state (const XMLNode& node, int version) return -1; } - uint32_t blocksize = 0; - if ((prop = node.property ("block_size")) != 0) { - sscanf (prop->value().c_str(), "%u", &blocksize); - } + uint32_t blocksize = 0; + if ((prop = node.property ("block-size")) != 0) { + sscanf (prop->value().c_str(), "%u", &blocksize); + } - //if the jack period is the same as when the value was saved, we can recall our latency.. - if ( (_session.get_block_size() == blocksize) && (prop = node.property ("latency")) != 0) { - uint32_t latency = 0; - sscanf (prop->value().c_str(), "%u", &latency); - _measured_latency = latency; - } + //if the jack period is the same as when the value was saved, we can recall our latency.. + if ( (_session.get_block_size() == blocksize) && (prop = node.property ("latency")) != 0) { + uint32_t latency = 0; + sscanf (prop->value().c_str(), "%u", &latency); + _measured_latency = latency; + } if (!node.property ("ignore-bitslot")) { if ((prop = node.property ("bitslot")) == 0) { @@ -240,7 +246,7 @@ PortInsert::signal_latency() const */ if (_measured_latency == 0) { - return _session.engine().frames_per_cycle() + _input->signal_latency(); + return _session.engine().samples_per_cycle() + _input->signal_latency(); } else { return _measured_latency; }