: Delivery (s, mm, string_compose (_("send %1"), (_bitslot = s.next_send_id()) + 1), r)
, _metering (false)
{
- _amp.reset (new Amp (_session, _mute_master));
+ _amp.reset (new Amp (_session));
_meter.reset (new PeakMeter (_session));
-
- ProcessorCreated (this); /* EMIT SIGNAL */
-}
-
-Send::Send (Session& s, boost::shared_ptr<MuteMaster> mm, const XMLNode& node, int version, Role r)
- : Delivery (s, mm, "send", r)
- , _metering (false)
-{
- _amp.reset (new Amp (_session, _mute_master));
- _meter.reset (new PeakMeter (_session));
-
- if (set_state (node, version)) {
- throw failed_constructor();
- }
-
- ProcessorCreated (this); /* EMIT SIGNAL */
}
Send::~Send ()
{
- GoingAway ();
+ _session.unmark_send_id (_bitslot);
}
void
}
void
-Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
+Send::run (BufferSet& bufs, framepos_t start_frame, framepos_t end_frame, nframes_t nframes, bool)
{
if (_output->n_ports() == ChanCount::ZERO) {
_meter->reset ();
// Can't automate gain for sends or returns yet because we need different buffers
// so that we don't overwrite the main automation data for the route amp
// _amp->setup_gain_automation (start_frame, end_frame, nframes);
- _amp->run (sendbufs, start_frame, end_frame, nframes);
+ _amp->run (sendbufs, start_frame, end_frame, nframes, true);
/* deliver to outputs */
- Delivery::run (sendbufs, start_frame, end_frame, nframes);
+ Delivery::run (sendbufs, start_frame, end_frame, nframes, true);
/* consider metering */
if (_amp->gain_control()->get_value() == 0) {
_meter->reset();
} else {
- _meter->run (*_output_buffers, start_frame, end_frame, nframes);
+ _meter->run (*_output_buffers, start_frame, end_frame, nframes, true);
}
}
}
XMLNode&
-Send::state(bool full)
+Send::state (bool full)
{
XMLNode& node = Delivery::state(full);
char buf[32];
int
Send::set_state (const XMLNode& node, int version)
{
+ if (version < 3000) {
+ return set_state_2X (node, version);
+ }
+
XMLNodeList nlist = node.children();
XMLNodeIterator niter;
const XMLProperty* prop;
- if ((prop = node.property ("bitslot")) == 0) {
- _bitslot = _session.next_send_id();
- } else {
- sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot);
- cerr << this << " scanned " << prop->value() << " to get " << _bitslot << endl;
- _session.mark_send_id (_bitslot);
- }
+ Delivery::set_state (node, version);
+
+ /* don't try to reset bitslot if its already set: this can cause
+ issues with the session's accounting of send ID's
+ */
- const XMLNode* insert_node = &node;
+ if ((prop = node.property ("bitslot")) == 0) {
+ _bitslot = _session.next_send_id();
+ } else {
+ _session.unmark_send_id (_bitslot);
+ sscanf (prop->value().c_str(), "%" PRIu32, &_bitslot);
+ _session.mark_send_id (_bitslot);
+ }
/* XXX need to load automation state & data for amp */
- Delivery::set_state (*insert_node, version);
+ return 0;
+}
+
+int
+Send::set_state_2X (const XMLNode& node, int version)
+{
+ /* use the IO's name for the name of the send */
+ XMLNodeList const & children = node.children ();
+
+ XMLNodeList::const_iterator i = children.begin();
+ while (i != children.end() && (*i)->name() != X_("Redirect")) {
+ ++i;
+ }
+
+ if (i == children.end()) {
+ return -1;
+ }
+
+ XMLNodeList const & grand_children = (*i)->children ();
+ XMLNodeList::const_iterator j = grand_children.begin ();
+ while (j != grand_children.end() && (*j)->name() != X_("IO")) {
+ ++j;
+ }
+
+ if (j == grand_children.end()) {
+ return -1;
+ }
+
+ XMLProperty const * prop = (*j)->property X_("name");
+ if (!prop) {
+ return -1;
+ }
+
+ set_name (prop->value ());
return 0;
}
return false;
}
+ if (_output) {
+ _output->ensure_io (out, false, 0);
+ }
+
if (!Processor::configure_io (in, out)) {
return false;
}
/* we ignore Deliver::_display_to_user */
if (_role == Listen) {
+ /* don't make the monitor/control/listen send visible */
return false;
}