#include <algorithm>
-#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 "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/io.h"
+
#include "i18n.h"
using namespace ARDOUR;
}
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;
- ProcessorCreated (this); /* EMIT SIGNAL */
-}
-
Send::~Send ()
{
GoingAway ();
if ((*niter)->name() == "IOProcessor") {
insert_node = *niter;
} else if ((*niter)->name() == X_("Automation")) {
- _io->set_automation_state (*(*niter), Parameter(GainAutomation));
+ // _io->set_automation_state (*(*niter), Evoral::Parameter(GainAutomation));
}
}
}
void
-Send::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes, nframes_t offset)
+Send::run_in_place (BufferSet& bufs, nframes_t start_frame, nframes_t end_frame, nframes_t nframes)
{
if (active()) {
sendbufs.read_from(bufs, nframes);
assert(sendbufs.count() == bufs.count());
- _io->deliver_output (sendbufs, start_frame, end_frame, nframes, offset);
+ _io->deliver_output (sendbufs, start_frame, end_frame, nframes);
if (_metering) {
- if (_io->_gain == 0) {
- _io->_meter->reset();
+ if (_io->effective_gain() == 0) {
+ _io->peak_meter().reset();
} else {
- _io->_meter->run_in_place(_io->output_buffers(), start_frame, end_frame, nframes, offset);
+ _io->peak_meter().run_in_place(_io->output_buffers(), start_frame, end_frame, nframes);
}
}
} else {
- _io->silence (nframes, offset);
+ _io->silence (nframes);
if (_metering) {
- _io->_meter->reset();
+ _io->peak_meter().reset();
}
}
}
_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);
+ }
+}