X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fio.cc;h=b72c29aae15d15e4d852d41a535aafb6722dccd2;hb=8367b7cab344e75908744a95fda860c7fadff420;hp=a9d37d4315cc9c6ad8930b416c965c9d1edc2913;hpb=8cd71108c1d153f84f25c3b9e5153a110826c130;p=ardour.git diff --git a/libs/ardour/io.cc b/libs/ardour/io.cc index a9d37d4315..b72c29aae1 100644 --- a/libs/ardour/io.cc +++ b/libs/ardour/io.cc @@ -39,6 +39,7 @@ #include "ardour/debug.h" #include "ardour/io.h" #include "ardour/port.h" +#include "ardour/profile.h" #include "ardour/route.h" #include "ardour/session.h" #include "ardour/user_bundle.h" @@ -527,7 +528,7 @@ IO::state (bool /*full_state*/) string str; vector::iterator ci; int n; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); Glib::Threads::Mutex::Lock lm (io_lock); node->add_property("name", _name); @@ -588,7 +589,7 @@ IO::set_state (const XMLNode& node, int version) const XMLProperty* prop; XMLNodeConstIterator iter; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); /* force use of non-localized representation of decimal point, since we use it a lot in XML files and so forth. @@ -644,7 +645,7 @@ IO::set_state_2X (const XMLNode& node, int version, bool in) { const XMLProperty* prop; XMLNodeConstIterator iter; - LocaleGuard lg (X_("POSIX")); + LocaleGuard lg (X_("C")); /* force use of non-localized representation of decimal point, since we use it a lot in XML files and so forth. @@ -692,13 +693,16 @@ IO::set_state_2X (const XMLNode& node, int version, bool in) int IO::connecting_became_legal () { - int ret; + int ret = 0; assert (pending_state_node); connection_legal_c.disconnect (); - ret = make_connections (*pending_state_node, pending_state_node_version, pending_state_node_in); + // it's not required for TracksLive, as long as TracksLive's session does all the cennections when it's being loaded + if (!Profile->get_trx() ) { + ret = make_connections (*pending_state_node, pending_state_node_version, pending_state_node_in); + } delete pending_state_node; pending_state_node = 0; @@ -854,6 +858,7 @@ IO::get_port_counts (const XMLNode& node, int version, ChanCount& n, boost::shar for (iter = node.children().begin(); iter != node.children().end(); ++iter) { if ((*iter)->name() == X_("Bundle")) { + prop = (*iter)->property ("name"); if ((c = find_possible_bundle (prop->value())) != 0) { n = ChanCount::max (n, c->nchannels()); return 0; @@ -1039,7 +1044,8 @@ IO::make_connections_2X (const XMLNode& node, int /*version*/, bool in) if (p != string::npos) { ports[x].replace (p, 4, "/audio_out"); } - nth(i)->connect (ports[x]); + if (NULL != nth(i).get()) + nth(i)->connect (ports[x]); } } @@ -1081,7 +1087,8 @@ IO::make_connections_2X (const XMLNode& node, int /*version*/, bool in) if (p != string::npos) { ports[x].replace (p, 3, "/audio_in"); } - nth(i)->connect (ports[x]); + if (NULL != nth(i).get()) + nth(i)->connect (ports[x]); } } @@ -1097,7 +1104,6 @@ int IO::set_ports (const string& str) { vector ports; - int i; int n; uint32_t nports; @@ -1114,14 +1120,10 @@ IO::set_ports (const string& str) } } - string::size_type start, end, ostart; - - ostart = 0; - start = 0; - end = 0; - i = 0; - - while ((start = str.find_first_of ('{', ostart)) != string::npos) { + string::size_type start = 0; + string::size_type end = 0; + string::size_type ostart = 0; + for (int i = 0; (start = str.find_first_of ('{', ostart)) != string::npos; ++i) { start += 1; if ((end = str.find_first_of ('}', start)) == string::npos) { @@ -1142,7 +1144,6 @@ IO::set_ports (const string& str) } ostart = end+1; - i++; } return 0; @@ -1179,7 +1180,6 @@ IO::parse_gain_string (const string& str, vector& ports) { string::size_type pos, opos; - pos = 0; opos = 0; ports.clear (); @@ -1344,7 +1344,7 @@ IO::bundle_changed (Bundle::Change /*c*/) string IO::build_legal_port_name (DataType type) { - const int name_size = jack_port_name_size(); + const int name_size = AudioEngine::instance()->port_name_size(); int limit; string suffix; @@ -1378,7 +1378,7 @@ IO::build_legal_port_name (DataType type) // allow up to 4 digits for the output port number, plus the slash, suffix and extra space - limit = name_size - _session.engine().client_name().length() - (suffix.length() + 5); + limit = name_size - AudioEngine::instance()->my_name().length() - (suffix.length() + 5); std::vector buf1(name_size+1); std::vector buf2(name_size+1); @@ -1411,10 +1411,10 @@ IO::find_port_hole (const char* base) */ for (n = 1; n < 9999; ++n) { - std::vector buf(jack_port_name_size()); + std::vector buf (AudioEngine::instance()->port_name_size()); PortSet::iterator i = _ports.begin(); - snprintf (&buf[0], jack_port_name_size(), _("%s %u"), base, n); + snprintf (&buf[0], buf.size()+1, _("%s %u"), base, n); for ( ; i != _ports.end(); ++i) { if (string(i->name()) == string(&buf[0])) { @@ -1611,8 +1611,10 @@ IO::connected_to (boost::shared_ptr other) const for (i = 0; i < no; ++i) { for (j = 0; j < ni; ++j) { - if (nth(i)->connected_to (other->nth(j)->name())) { - return true; + if ((NULL != nth(i).get()) && (NULL != other->nth(j).get())) { + if (nth(i)->connected_to (other->nth(j)->name())) { + return true; + } } } } @@ -1645,7 +1647,7 @@ IO::process_input (boost::shared_ptr proc, framepos_t start_frame, fr return; } - _buffers.get_jack_port_addresses (_ports, nframes); + _buffers.get_backend_port_addresses (_ports, nframes); if (proc) { proc->run (_buffers, start_frame, end_frame, nframes, true); }