allow feedback (loops) from internal sends
authorRobin Gareus <robin@gareus.org>
Fri, 14 Oct 2016 13:06:49 +0000 (15:06 +0200)
committerRobin Gareus <robin@gareus.org>
Fri, 14 Oct 2016 13:06:49 +0000 (15:06 +0200)
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
libs/ardour/internal_send.cc

index 263c40b90b86a278135a5aa2d581bae1afefe3b2..8a85fc0f68972703385ac0a73e5efb3b0d4f6709 100644 (file)
@@ -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<Route> _send_from;
        boost::shared_ptr<Route> _send_to;
+       bool _allow_feedback;
        PBD::ID _send_to_id;
        PBD::ScopedConnection connect_c;
        PBD::ScopedConnection source_connection;
index 1746b00847e49a739f19293de18269fa3fb4ed62..241506bdead180f7caa351746d9d5aca82a47d35 100644 (file)
@@ -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<Route> 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;
 }