13
0

basic integration of delaylines (still un-nused)

This commit is contained in:
Robin Gareus 2014-06-11 17:14:18 +02:00
parent 626b2daa82
commit ca3c9cae6e
9 changed files with 88 additions and 5 deletions

View File

@ -35,6 +35,7 @@ namespace PBD {
LIBARDOUR_API extern uint64_t SnapBBT;
LIBARDOUR_API extern uint64_t Configuration;
LIBARDOUR_API extern uint64_t Latency;
LIBARDOUR_API extern uint64_t LatencyCompensation;
LIBARDOUR_API extern uint64_t Peaks;
LIBARDOUR_API extern uint64_t Processors;
LIBARDOUR_API extern uint64_t ProcessThreads;

View File

@ -54,6 +54,7 @@
namespace ARDOUR {
class Amp;
class DelayLine;
class Delivery;
class IOProcessor;
class Panner;
@ -190,6 +191,7 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
PeakMeter& peak_meter() { return *_meter.get(); }
const PeakMeter& peak_meter() const { return *_meter.get(); }
boost::shared_ptr<PeakMeter> shared_peak_meter() const { return _meter; }
boost::shared_ptr<DelayLine> delay_line() const { return _delayline; }
void flush_processors ();
@ -547,6 +549,7 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
boost::shared_ptr<Amp> _amp;
boost::shared_ptr<PeakMeter> _meter;
boost::shared_ptr<DelayLine> _delayline;
boost::shared_ptr<Processor> the_instrument_unlocked() const;

View File

@ -26,6 +26,7 @@
#include "ardour/ardour.h"
#include "ardour/delivery.h"
#include "ardour/delayline.h"
namespace ARDOUR {
@ -59,6 +60,12 @@ class LIBARDOUR_API Send : public Delivery
bool can_support_io_configuration (const ChanCount& in, ChanCount& out);
bool configure_io (ChanCount in, ChanCount out);
/* latency compensation */
void set_delay_in (framecnt_t);
void set_delay_out (framecnt_t);
framecnt_t get_delay_in () const { return _delay_in; }
framecnt_t get_delay_out () const { return _delay_out; }
void activate ();
void deactivate ();
@ -73,6 +80,7 @@ class LIBARDOUR_API Send : public Delivery
bool _metering;
boost::shared_ptr<Amp> _amp;
boost::shared_ptr<PeakMeter> _meter;
boost::shared_ptr<DelayLine> _delayline;
private:
/* disallow copy construction */
@ -82,6 +90,9 @@ class LIBARDOUR_API Send : public Delivery
int set_state_2X (XMLNode const &, int);
uint32_t _bitslot;
framecnt_t _delay_in;
framecnt_t _delay_out;
};
} // namespace ARDOUR

View File

@ -31,6 +31,7 @@ uint64_t PBD::DEBUG::MidiDiskstreamIO = PBD::new_debug_bit ("mididiskstreamio");
uint64_t PBD::DEBUG::SnapBBT = PBD::new_debug_bit ("snapbbt");
uint64_t PBD::DEBUG::Configuration = PBD::new_debug_bit ("configuration");
uint64_t PBD::DEBUG::Latency = PBD::new_debug_bit ("latency");
uint64_t PBD::DEBUG::LatencyCompensation = PBD::new_debug_bit ("latencycompensation");
uint64_t PBD::DEBUG::Peaks = PBD::new_debug_bit ("peaks");
uint64_t PBD::DEBUG::Processors = PBD::new_debug_bit ("processors");
uint64_t PBD::DEBUG::ProcessThreads = PBD::new_debug_bit ("processthreads");

View File

@ -249,6 +249,7 @@ Delivery::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pf
processing pathway that wants to use this->output_buffers() for some reason.
*/
// TODO delayline -- latency-compensation
output_buffers().get_backend_port_addresses (ports, nframes);
// this Delivery processor is not a derived type, and thus we assume

View File

@ -202,6 +202,8 @@ InternalSend::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame
_amp->setup_gain_automation (start_frame, end_frame, nframes);
_amp->run (mixbufs, start_frame, end_frame, nframes, true);
_delayline->run (mixbufs, start_frame, end_frame, nframes, true);
/* consider metering */
if (_metering) {

View File

@ -47,6 +47,7 @@
#include "ardour/internal_return.h"
#include "ardour/internal_send.h"
#include "ardour/meter.h"
#include "ardour/delayline.h"
#include "ardour/midi_buffer.h"
#include "ardour/midi_port.h"
#include "ardour/monitor_processor.h"
@ -142,6 +143,11 @@ Route::init ()
_output->changed.connect_same_thread (*this, boost::bind (&Route::output_change_handler, this, _1, _2));
_output->PortCountChanging.connect_same_thread (*this, boost::bind (&Route::output_port_count_changing, this, _1));
if (!is_master() && !is_monitor() && !is_auditioner()) {
_delayline.reset (new DelayLine (_session, _name));
add_processor (_delayline, PreFader);
}
/* add amp processor */
_amp.reset (new Amp (_session));
@ -1431,7 +1437,7 @@ Route::clear_processors (Placement p)
seen_amp = true;
}
if ((*i) == _amp || (*i) == _meter || (*i) == _main_outs) {
if ((*i) == _amp || (*i) == _meter || (*i) == _main_outs || (*i) == _delayline) {
/* you can't remove these */
@ -1498,7 +1504,7 @@ Route::remove_processor (boost::shared_ptr<Processor> processor, ProcessorStream
/* these can never be removed */
if (processor == _amp || processor == _meter || processor == _main_outs) {
if (processor == _amp || processor == _meter || processor == _main_outs || processor == _delayline) {
return 0;
}
@ -1615,7 +1621,7 @@ Route::remove_processors (const ProcessorList& to_be_deleted, ProcessorStreams*
/* these can never be removed */
if (processor == _amp || processor == _meter || processor == _main_outs) {
if (processor == _amp || processor == _meter || processor == _main_outs || processor == _delayline) {
++i;
continue;
}
@ -2580,6 +2586,9 @@ Route::set_processor_state (const XMLNode& node)
} else if (prop->value() == "meter") {
_meter->set_state (**niter, Stateful::current_state_version);
new_order.push_back (_meter);
} else if (prop->value() == "delay") {
_delayline->set_state (**niter, Stateful::current_state_version);
new_order.push_back (_delayline);
} else if (prop->value() == "main-outs") {
_main_outs->set_state (**niter, Stateful::current_state_version);
} else if (prop->value() == "intreturn") {
@ -4101,6 +4110,10 @@ Route::setup_invisible_processors ()
}
}
if (!is_master() && !is_monitor() && !is_auditioner()) {
new_processors.push_front (_delayline);
}
/* MONITOR CONTROL */
if (_monitor_control && is_monitor ()) {
@ -4257,6 +4270,10 @@ Route::non_realtime_locate (framepos_t pos)
_pannable->transport_located (pos);
}
if (_delayline.get()) {
_delayline.get()->flush();
}
{
//Glib::Threads::Mutex::Lock lx (AudioEngine::instance()->process_lock ());
Glib::Threads::RWLock::ReaderLock lm (_processor_lock);

View File

@ -73,6 +73,8 @@ Send::name_and_id_new_send (Session& s, Role r, uint32_t& bitslot, bool ignore_b
Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMaster> mm, Role r, bool ignore_bitslot)
: Delivery (s, p, mm, name_and_id_new_send (s, r, _bitslot, ignore_bitslot), r)
, _metering (false)
, _delay_in (0)
, _delay_out (0)
{
if (_role == Listen) {
/* we don't need to do this but it keeps things looking clean
@ -86,6 +88,8 @@ Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMas
_amp.reset (new Amp (_session));
_meter.reset (new PeakMeter (_session, name()));
_delayline.reset (new DelayLine (_session, name()));
add_control (_amp->gain_control ());
if (panner_shell()) {
@ -117,6 +121,30 @@ Send::deactivate ()
Processor::deactivate ();
}
void
Send::set_delay_in(framecnt_t delay)
{
if (!_delayline) return;
if (_delay_in == delay) {
return;
}
_delay_in = delay;
cerr << "SEND DELAY Pre: " << delay << "\n";
_delayline.get()->set_delay(_delay_out + _delay_in);
}
void
Send::set_delay_out(framecnt_t delay)
{
if (!_delayline) return;
if (_delay_out == delay) {
return;
}
_delay_out = delay;
cerr << "SEND DELAY Post: " << delay << "\n";
_delayline.get()->set_delay(_delay_out + _delay_in);
}
void
Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframes_t nframes, bool)
{
@ -146,6 +174,8 @@ Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, pframe
_amp->setup_gain_automation (start_frame, end_frame, nframes);
_amp->run (sendbufs, start_frame, end_frame, nframes, true);
_delayline->run (sendbufs, start_frame, end_frame, nframes, true);
/* deliver to outputs */
Delivery::run (sendbufs, start_frame, end_frame, nframes, true);
@ -301,6 +331,11 @@ Send::configure_io (ChanCount in, ChanCount out)
return false;
}
if (_delayline && !_delayline->configure_io(in, out)) {
cerr << "send delayline config failed\n";
return false;
}
reset_panner ();
return true;

View File

@ -1421,7 +1421,13 @@ Session::XMLRouteFactory (const XMLNode& node, int version)
ret = track;
} else {
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML")));
enum Route::Flag flags = Route::Flag(0);
const XMLProperty* prop = node.property("flags");
if (prop) {
flags = Route::Flag (string_2_enum (prop->value(), flags));
}
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML"), flags));
if (r->init () == 0 && r->set_state (node, version) == 0) {
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS
@ -1493,7 +1499,13 @@ Session::XMLRouteFactory_2X (const XMLNode& node, int version)
ret = track;
} else {
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML")));
enum Route::Flag flags = Route::Flag(0);
const XMLProperty* prop = node.property("flags");
if (prop) {
flags = Route::Flag (string_2_enum (prop->value(), flags));
}
boost::shared_ptr<Route> r (new Route (*this, X_("toBeResetFroXML"), flags));
if (r->init () == 0 && r->set_state (node, version) == 0) {
#ifdef BOOST_SP_ENABLE_DEBUG_HOOKS