*** NEW CODING POLICY ***
[ardour.git] / libs / ardour / send.cc
index d562ddff3f2860dcdbde46dc5a5a4351b568921c..c41ca770f8ceb7b26eb0ff38d5aee905cc6d86de 100644 (file)
 
 #include <algorithm>
 
-#include <pbd/xml++.h>
+#include "pbd/xml++.h"
 
-#include <ardour/send.h>
-#include <ardour/session.h>
-#include <ardour/port.h>
-#include <ardour/audio_port.h>
-#include <ardour/buffer_set.h>
-#include <ardour/meter.h>
-#include <ardour/panner.h>
+#include "ardour/send.h"
+#include "ardour/session.h"
+#include "ardour/port.h"
+#include "ardour/audio_port.h"
+#include "ardour/buffer_set.h"
+#include "ardour/meter.h"
+#include "ardour/panner.h"
+#include "ardour/io.h"
 
 #include "i18n.h"
 
@@ -42,7 +43,7 @@ Send::Send (Session& s, Placement p)
 }
 
 Send::Send (Session& s, const XMLNode& node)
-       : IOProcessor (s,  "send", PreFader)
+       : IOProcessor (s, "send", PreFader)
 {
        _metering = false;
 
@@ -53,48 +54,6 @@ Send::Send (Session& s, const XMLNode& node)
        ProcessorCreated (this); /* EMIT SIGNAL */
 }
 
-Send::Send (const Send& other)
-       : IOProcessor (other._session, string_compose (_("send %1"), (bitslot = other._session.next_send_id()) + 1), other.placement())
-{
-       _metering = false;
-
-       expected_inputs.set (DataType::AUDIO, 0);
-
-#ifdef THIS_NEEDS_FIXING_FOR_V3
-
-       /* set up the same outputs, and connect them to the same places */
-
-       _io->no_panner_reset = true;
-
-       for (uint32_t i = 0; i < other.n_outputs (); ++i) {
-               add_output_port ("", 0);
-               Port* p = other.output (i);
-               if (p) {
-                       /* this is what the other send's output is connected to */
-                       const char **connections = p->get_connections ();
-                       if (connections) {
-                               for (uint32_t c = 0; connections[c]; ++c) {
-                                       connect_output (output (i), connections [c], 0);
-                               }
-                       }
-               }
-       }
-       
-       /* setup panner */
-
-       _io->no_panner_reset = false;
-
-       /* copy state */
-
-       XMLNode& other_state (const_cast<Send*>(&other)->_panner->get_state());
-       _panner->set_state (other_state);
-       
-       delete &other_state;
-#endif
-
-       ProcessorCreated (this); /* EMIT SIGNAL */
-}
-
 Send::~Send ()
 {
        GoingAway ();
@@ -264,3 +223,26 @@ Send::expect_inputs (const ChanCount& expected)
                _io->reset_panner ();
        }
 }
+
+/** Set up the XML description of a send so that its name is unique.
+ *  @param state XML send state.
+ *  @param session Session.
+ */
+void
+Send::make_unique (XMLNode &state, Session &session)
+{
+       uint32_t const bitslot = session.next_send_id() + 1;
+
+       char buf[32];
+       snprintf (buf, sizeof (buf), "%" PRIu32, bitslot);
+       state.property("bitslot")->set_value (buf);
+
+       std::string const name = string_compose (_("send %1"), bitslot);
+       
+       state.property("name")->set_value (name);
+
+       XMLNode* io = state.child ("IO");
+       if (io) {
+               io->property("name")->set_value (name);
+       }
+}