+ }
+ }
+ }
+
+ return 0;
+}
+
+
+int
+IO::make_connections_2X (const XMLNode& node, int /*version*/, bool in)
+{
+ const XMLProperty* prop;
+
+ /* XXX: bundles ("connections" as was) */
+
+ if ((prop = node.property ("inputs")) != 0 && in) {
+
+ string::size_type ostart = 0;
+ string::size_type start = 0;
+ string::size_type end = 0;
+ int i = 0;
+ int n;
+ vector<string> ports;
+
+ string const str = prop->value ();
+
+ while ((start = str.find_first_of ('{', ostart)) != string::npos) {
+ start += 1;
+
+ if ((end = str.find_first_of ('}', start)) == string::npos) {
+ error << string_compose(_("IO: badly formed string in XML node for inputs \"%1\""), str) << endmsg;
+ return -1;
+ }
+
+ if ((n = parse_io_string (str.substr (start, end - start), ports)) < 0) {
+ error << string_compose(_("bad input string in XML node \"%1\""), str) << endmsg;
+
+ return -1;
+
+ } else if (n > 0) {
+
+
+ for (int x = 0; x < n; ++x) {
+ /* XXX: this is a bit of a hack; need to check if it's always valid */
+ string::size_type const p = ports[x].find ("/out");
+ if (p != string::npos) {
+ ports[x].replace (p, 4, "/audio_out");
+ }
+ nth(i)->connect (ports[x]);
+ }
+ }
+
+ ostart = end+1;
+ i++;
+ }
+
+ }
+
+ if ((prop = node.property ("outputs")) != 0 && !in) {
+
+ string::size_type ostart = 0;
+ string::size_type start = 0;
+ string::size_type end = 0;
+ int i = 0;
+ int n;
+ vector<string> ports;
+
+ string const str = prop->value ();
+
+ while ((start = str.find_first_of ('{', ostart)) != string::npos) {
+ start += 1;
+
+ if ((end = str.find_first_of ('}', start)) == string::npos) {
+ error << string_compose(_("IO: badly formed string in XML node for outputs \"%1\""), str) << endmsg;
+ return -1;
+ }
+
+ if ((n = parse_io_string (str.substr (start, end - start), ports)) < 0) {
+ error << string_compose(_("IO: bad output string in XML node \"%1\""), str) << endmsg;
+
+ return -1;
+
+ } else if (n > 0) {
+
+ for (int x = 0; x < n; ++x) {
+ /* XXX: this is a bit of a hack; need to check if it's always valid */
+ string::size_type const p = ports[x].find ("/in");
+ if (p != string::npos) {
+ ports[x].replace (p, 3, "/audio_in");
+ }
+ nth(i)->connect (ports[x]);
+ }