Several changes to Mackie support. Breaks existing Mackie state on disk but not

in any way that causes problems, just loss of pre-existing connectivity.

1. retain state of current device (and serialize to disk) when switching
devices, and restore that state when switching back to it.
2. fix port and surfacenaming.
3. fix bundle assembly so that all ports (for multi-surface combos) work.
4. rationalize master position numbering
5. add small sleep before starting device handshake after reconnection. This
is ugly but seems to be necessary, unfortunately.
This commit is contained in:
Paul Davis 2015-10-11 11:58:00 -04:00
parent 6faec91dd9
commit f8875df18f
5 changed files with 139 additions and 50 deletions

View file

@ -229,7 +229,6 @@ Surface::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, b
*/
g_usleep (100000);
connected ();
} else {
@ -243,21 +242,29 @@ Surface::connection_handler (boost::weak_ptr<ARDOUR::Port>, std::string name1, b
XMLNode&
Surface::get_state()
{
char buf[64];
snprintf (buf, sizeof (buf), X_("surface-%u"), _number);
XMLNode* node = new XMLNode (buf);
XMLNode* node = new XMLNode (X_("Surface"));
node->add_property (X_("name"), _name);
node->add_child_nocopy (_port->get_state());
return *node;
}
int
Surface::set_state (const XMLNode& node, int version)
{
char buf[64];
snprintf (buf, sizeof (buf), X_("surface-%u"), _number);
XMLNode* mynode = node.child (buf);
/* Look for a node named after this surface */
XMLNodeList const& children = node.children();
XMLNode* mynode = 0;
for (XMLNodeList::const_iterator c = children.begin(); c != children.end(); ++c) {
XMLProperty const* prop = (*c)->property (X_("name"));
if (prop) {
if (prop->value() == _name) {
mynode = *c;
break;
}
}
}
if (!mynode) {
return 0;