#include "ardour/port.h"
#include "ardour/port_engine.h"
-#include "i18n.h"
+#include "pbd/i18n.h"
using namespace std;
using namespace ARDOUR;
: _port_buffer_offset (0)
, _name (n)
, _flags (f)
- , _last_monitor (false)
+ , _last_monitor (false)
{
_private_playback_latency.min = 0;
_private_playback_latency.max = 0;
assert (_name.find_first_of (':') == std::string::npos);
- if ((_port_handle = port_engine.register_port (_name, t, _flags)) == 0) {
+ if (!port_engine.available ()) {
+ DEBUG_TRACE (DEBUG::Ports, string_compose ("port-engine n/a postpone registering %1\n", name()));
+ _port_handle = 0; // created during ::reestablish() later
+ } else if ((_port_handle = port_engine.register_port (_name, t, _flags)) == 0) {
cerr << "Failed to register port \"" << _name << "\", reason is unknown from here\n";
throw failed_constructor ();
}
+ DEBUG_TRACE (DEBUG::Ports, string_compose ("registed port %1 handle %2\n", name(), _port_handle));
PortDrop.connect_same_thread (drop_connection, boost::bind (&Port::drop, this));
PortSignalDrop.connect_same_thread (drop_connection, boost::bind (&Port::signal_drop, this));
return -1;
}
+ DEBUG_TRACE (DEBUG::Ports, string_compose ("Port::reestablish %1 handle %2\n", name(), _port_handle));
+
reset ();
port_manager->PortConnectedOrDisconnected.connect_same_thread (engine_connection,
{
XMLNode* root = new XMLNode (state_node_name);
- root->add_property (X_("name"), AudioEngine::instance()->make_port_name_relative (name()));
+ root->set_property (X_("name"), AudioEngine::instance()->make_port_name_relative (name()));
if (receives_input()) {
- root->add_property (X_("direction"), X_("input"));
+ root->set_property (X_("direction"), X_("input"));
} else {
- root->add_property (X_("direction"), X_("output"));
+ root->set_property (X_("direction"), X_("output"));
}
vector<string> c;
for (vector<string>::const_iterator i = c.begin(); i != c.end(); ++i) {
XMLNode* child = new XMLNode (X_("Connection"));
- child->add_property (X_("other"), *i);
+ child->set_property (X_("other"), *i);
root->add_child_nocopy (*child);
}
int
Port::set_state (const XMLNode& node, int)
{
- XMLProperty const * prop;
-
if (node.name() != state_node_name) {
return -1;
}
- if ((prop = node.property (X_("name"))) != 0) {
- set_name (prop->value());
+ std::string str;
+ if (node.get_property (X_("name"), str)) {
+ set_name (str);
}
const XMLNodeList& children (node.children());
continue;
}
- if ((prop = (*c)->property (X_("other"))) == 0) {
+ if (!(*c)->get_property (X_("other"), str)) {
continue;
}
- _connections.insert (prop->value());
+ _connections.insert (str);
}
return 0;