#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"
}
Send::Send (Session& s, const XMLNode& node)
- : IOProcessor (s, "send", PreFader)
+ : IOProcessor (s, "send", PreFader)
{
_metering = false;
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 ();
_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);
+ }
+}