summaryrefslogtreecommitdiff
path: root/libs/ardour/send.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/send.cc')
-rw-r--r--libs/ardour/send.cc47
1 files changed, 44 insertions, 3 deletions
diff --git a/libs/ardour/send.cc b/libs/ardour/send.cc
index 71cab46879..87aadf4193 100644
--- a/libs/ardour/send.cc
+++ b/libs/ardour/send.cc
@@ -24,12 +24,13 @@
#include "pbd/boost_debug.h"
#include "ardour/amp.h"
-#include "ardour/send.h"
-#include "ardour/session.h"
#include "ardour/buffer_set.h"
-#include "ardour/meter.h"
+#include "ardour/debug.h"
#include "ardour/io.h"
+#include "ardour/meter.h"
#include "ardour/panner_shell.h"
+#include "ardour/send.h"
+#include "ardour/session.h"
#include "i18n.h"
@@ -73,6 +74,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 +89,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()) {
@@ -118,6 +123,35 @@ Send::deactivate ()
}
void
+Send::set_delay_in(framecnt_t delay)
+{
+ if (!_delayline) return;
+ if (_delay_in == delay) {
+ return;
+ }
+ _delay_in = delay;
+
+ DEBUG_TRACE (DEBUG::LatencyCompensation,
+ string_compose ("Send::set_delay_in(%1) + %2 = %3\n",
+ delay, _delay_out, _delay_out + _delay_in));
+ _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;
+ DEBUG_TRACE (DEBUG::LatencyCompensation,
+ string_compose ("Send::set_delay_out(%1) + %2 = %3\n",
+ delay, _delay_in, _delay_out + _delay_in));
+ _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)
{
if (_output->n_ports() == ChanCount::ZERO) {
@@ -146,6 +180,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 +337,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;