diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2019-11-11 18:02:37 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2019-11-15 16:04:58 -0700 |
commit | 2f87b111e55b8eeb975de150941127dd54b6ee3f (patch) | |
tree | d8aa965bef385acdce779139f0169055283384a9 /libs/ardour/transport_master_manager.cc | |
parent | 457ab6d35fdd3ea0166097b140b26dc083edc019 (diff) |
fix up the creation & state restore of the TransportMasterManager
Diffstat (limited to 'libs/ardour/transport_master_manager.cc')
-rw-r--r-- | libs/ardour/transport_master_manager.cc | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/libs/ardour/transport_master_manager.cc b/libs/ardour/transport_master_manager.cc index 66c99db8e9..22faf4dd85 100644 --- a/libs/ardour/transport_master_manager.cc +++ b/libs/ardour/transport_master_manager.cc @@ -52,11 +52,10 @@ TransportMasterManager::create () { assert (!_instance); - cerr << "TMM::create(), Config = " << Config << " size will be " << sizeof (TransportMasterManager) << endl; - _instance = new TransportMasterManager; - XMLNode* tmm_node = Config->extra_xml (X_("TransportMasters")); + XMLNode* tmm_node = Config->transport_master_state (); + if (tmm_node) { cerr << " setting state via XML\n"; _instance->set_state (*tmm_node, Stateful::current_state_version); @@ -556,21 +555,11 @@ TransportMasterManager::set_state (XMLNode const & node, int version) } } - std::string current_master; - - if (node.get_property (X_("current"), current_master)) { - - /* may fal if current_master is not usable */ - - set_current (current_master); - - if (!current()) { - set_current (MTC); // always available - } + /* fallback choice, lives on until ::restart() is called after the + * engine is running. + */ - } else { - set_current (MTC); - } + set_current (MTC); return 0; } @@ -627,11 +616,26 @@ TransportMasterManager::restart () if ((node = Config->transport_master_state()) != 0) { - Glib::Threads::RWLock::ReaderLock lm (lock); + { + Glib::Threads::RWLock::ReaderLock lm (lock); - for (TransportMasters::const_iterator tm = _transport_masters.begin(); tm != _transport_masters.end(); ++tm) { - (*tm)->connect_port_using_state (); - (*tm)->reset (false); + for (TransportMasters::const_iterator tm = _transport_masters.begin(); tm != _transport_masters.end(); ++tm) { + (*tm)->connect_port_using_state (); + (*tm)->reset (false); + } + } + + /* engine is running, connections are viable ... try to set current */ + + std::string current_master; + + if (node->get_property (X_("current"), current_master)) { + + /* may fal if current_master is not usable */ + + cerr << "RESTART: Setting TM to " << current_master << endl; + + set_current (current_master); } } else { |