From c21a0760a48ebd1d014d7ca66366477715cbb4a5 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 14 Oct 2016 15:06:49 +0200 Subject: [PATCH] allow feedback (loops) from internal sends This facilitates custom "Echo" chains: Bus 1 [FX] [aux-send to Bus 2] -> master Bus 2 [FX] -> Bus 2 --- libs/ardour/ardour/internal_send.h | 4 ++++ libs/ardour/internal_send.cc | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/libs/ardour/ardour/internal_send.h b/libs/ardour/ardour/internal_send.h index 263c40b90b..8a85fc0f68 100644 --- a/libs/ardour/ardour/internal_send.h +++ b/libs/ardour/ardour/internal_send.h @@ -54,6 +54,9 @@ class LIBARDOUR_API InternalSend : public Send return mixbufs; } + bool allow_feedback () const { return _allow_feedback;} + void set_allow_feedback (bool yn); + void set_can_pan (bool yn); uint32_t pan_outs () const; @@ -63,6 +66,7 @@ class LIBARDOUR_API InternalSend : public Send BufferSet mixbufs; boost::shared_ptr _send_from; boost::shared_ptr _send_to; + bool _allow_feedback; PBD::ID _send_to_id; PBD::ScopedConnection connect_c; PBD::ScopedConnection source_connection; diff --git a/libs/ardour/internal_send.cc b/libs/ardour/internal_send.cc index 1746b00847..241506bdea 100644 --- a/libs/ardour/internal_send.cc +++ b/libs/ardour/internal_send.cc @@ -49,6 +49,7 @@ InternalSend::InternalSend (Session& s, bool ignore_bitslot) : Send (s, p, mm, role, ignore_bitslot) , _send_from (sendfrom) + , _allow_feedback (false) { if (sendto) { if (use_target (sendto)) { @@ -266,10 +267,20 @@ InternalSend::set_block_size (pframes_t nframes) return 0; } +void +InternalSend::set_allow_feedback (bool yn) +{ + _allow_feedback = yn; + _send_from->processors_changed (RouteProcessorChange ()); /* EMIT SIGNAL */ +} + bool InternalSend::feeds (boost::shared_ptr other) const { - return _send_to == other; + if (_role == Listen || !_allow_feedback) { + return _send_to == other; + } + return false; } XMLNode& @@ -284,6 +295,7 @@ InternalSend::state (bool full) if (_send_to) { node.add_property ("target", _send_to->id().to_s()); } + node.add_property ("allow-feedback", _allow_feedback); return node; } @@ -319,6 +331,10 @@ InternalSend::set_state (const XMLNode& node, int version) } } + if ((prop = node.property (X_("allow-feedback"))) != 0) { + _allow_feedback = string_is_affirmative (prop->value()); + } + return 0; }