13
0

better, cleaner fix for copying sends/returns/port inserts via XML state

git-svn-id: svn://localhost/ardour2/branches/3.0@11691 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-03-15 02:31:09 +00:00
parent 86a0fe1b43
commit 730937dc37
8 changed files with 22 additions and 85 deletions

View File

@ -75,6 +75,8 @@ class IOProcessor : public Processor
XMLNode& state (bool full_state);
int set_state (const XMLNode&, int version);
static void prepare_for_reset (XMLNode& state, const std::string& name);
protected:
boost::shared_ptr<IO> _input;
boost::shared_ptr<IO> _output;

View File

@ -45,8 +45,6 @@ class PortInsert : public IOProcessor
{
public:
PortInsert (Session&, boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster> mm);
PortInsert (Session&, const std::string&, uint32_t bitslot,
boost::shared_ptr<Pannable>, boost::shared_ptr<MuteMaster> mm);
~PortInsert ();
XMLNode& state(bool full);
@ -74,7 +72,6 @@ class PortInsert : public IOProcessor
void set_measured_latency (framecnt_t);
framecnt_t latency () const;
static void make_unique (XMLNode &);
static std::string name_and_id_new_insert (Session&, uint32_t&);
private:

View File

@ -33,11 +33,11 @@ namespace ARDOUR {
class Amp;
class PeakMeter;
class Return : public IOProcessor
{
public:
Return (Session&, bool internal = false);
Return (Session&, const std::string& name, uint32_t bslot, bool internal = false);
virtual ~Return ();
uint32_t bit_slot() const { return _bitslot; }
@ -60,7 +60,6 @@ public:
bool configure_io (ChanCount in, ChanCount out);
static uint32_t how_many_returns();
static void make_unique (XMLNode &);
static std::string name_and_id_new_return (Session&, uint32_t&);
protected:

View File

@ -36,7 +36,6 @@ class Send : public Delivery
{
public:
Send (Session&, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send);
Send (Session&, const std::string& name, uint32_t bitslot, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster>, Delivery::Role r = Delivery::Send);
virtual ~Send ();
uint32_t bit_slot() const { return _bitslot; }
@ -68,7 +67,6 @@ class Send : public Delivery
std::string value_as_string (boost::shared_ptr<AutomationControl>) const;
static uint32_t how_many_sends();
static void make_unique (XMLNode &);
static std::string name_and_id_new_send (Session&, Delivery::Role r, uint32_t&);
protected:

View File

@ -155,6 +155,7 @@ IOProcessor::set_state (const XMLNode& node, int version)
Processor::set_state(node, version);
if ((prop = node.property ("own-input")) != 0) {
_own_input = string_is_affirmative (prop->value());
}
@ -302,3 +303,21 @@ IOProcessor::disconnect ()
_output->disconnect (this);
}
}
/** Set up the XML description of a send so that we will not
* reset its name or bitslot during ::set_state()
* @param state XML send state.
* @param session Session.
*/
void
IOProcessor::prepare_for_reset (XMLNode &state, const std::string& name)
{
state.add_property ("ignore-bitslot", "1");
state.add_property ("ignore-name", "1");
XMLNode* io_node = state.child (IO::state_node_name.c_str());
if (io_node) {
io_node->add_property ("name", name);
}
}

View File

@ -58,17 +58,6 @@ PortInsert::PortInsert (Session& s, boost::shared_ptr<Pannable> pannable, boost:
_measured_latency = 0;
}
PortInsert::PortInsert (Session& s, const std::string& name, uint32_t bslot, boost::shared_ptr<Pannable> pannable, boost::shared_ptr<MuteMaster> mm)
: IOProcessor (s, true, true, name, "")
, _out (new Delivery (s, _output, pannable, mm, _name, Delivery::Insert))
, _bitslot (bslot)
{
_mtdm = 0;
_latency_detect = false;
_latency_flush_frames = false;
_measured_latency = 0;
}
PortInsert::~PortInsert ()
{
_session.unmark_insert_id (_bitslot);
@ -315,15 +304,3 @@ PortInsert::deactivate ()
_out->deactivate ();
}
/** Set up the XML description of a send so that we will not
* reset its name or bitslot during ::set_state()
* @param state XML insert state.
*/
void
PortInsert::make_unique (XMLNode &state)
{
state.add_property ("ignore-bitslot", "1");
state.add_property ("ignore-name", "1");
}

View File

@ -57,17 +57,6 @@ Return::Return (Session& s, bool internal)
_meter.reset (new PeakMeter (_session));
}
Return::Return (Session& s, const std::string& name, uint32_t bslot, bool internal)
: IOProcessor (s, (internal ? false : true), false, name)
, _metering (false)
, _bitslot (bslot)
{
/* never muted */
_amp.reset (new Amp (_session));
_meter.reset (new PeakMeter (_session));
}
Return::~Return ()
{
_session.unmark_return_id (_bitslot);
@ -175,15 +164,3 @@ Return::configure_io (ChanCount in, ChanCount out)
return true;
}
/** Set up the XML description of a return so that we will not
* reset its name or bitslot during ::set_state()
* @param state XML return state.
*/
void
Return::make_unique (XMLNode &state)
{
state.add_property ("ignore-bitslot", "1");
state.add_property ("ignore-name", "1");
}

View File

@ -85,26 +85,6 @@ Send::Send (Session& s, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMas
add_control (_amp->gain_control ());
}
Send::Send (Session& s, const std::string& name, uint32_t bslot, boost::shared_ptr<Pannable> p, boost::shared_ptr<MuteMaster> mm, Role r)
: Delivery (s, p, mm, name, r)
, _metering (false)
, _bitslot (bslot)
{
if (_role == Listen) {
/* we don't need to do this but it keeps things looking clean
in a debugger. _bitslot is not used by listen sends.
*/
_bitslot = 0;
}
boost_debug_shared_ptr_mark_interesting (this, "send");
_amp.reset (new Amp (_session));
_meter.reset (new PeakMeter (_session));
add_control (_amp->gain_control ());
}
Send::~Send ()
{
_session.unmark_send_id (_bitslot);
@ -315,18 +295,6 @@ Send::configure_io (ChanCount in, ChanCount out)
return true;
}
/** Set up the XML description of a send so that we will not
* reset its name or bitslot during ::set_state()
* @param state XML send state.
* @param session Session.
*/
void
Send::make_unique (XMLNode &state)
{
state.add_property ("ignore-bitslot", "1");
state.add_property ("ignore-name", "1");
}
bool
Send::set_name (const string& new_name)
{