X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_state.cc;h=73ba3918738cb540b698d9ce34e22c10b846bb6f;hb=8277d134b9733aee344782891c99f07114384d9e;hp=78d8aa6ac7f13cf743cfb50f6058acfb8d66dd73;hpb=60454cc8dc1ca5e1819b853b55916d52497d495c;p=ardour.git diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index 78d8aa6ac7..73ba391873 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -167,7 +167,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) _slave_type = None; butler_mixdown_buffer = 0; butler_gain_buffer = 0; - auditioner = 0; mmc_control = false; midi_control = true; mmc = 0; @@ -182,8 +181,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) _edit_mode = Slide; pending_edit_mode = _edit_mode; _play_range = false; - _control_out = 0; - _master_out = 0; input_auto_connect = AutoConnectOption (0); output_auto_connect = AutoConnectOption (0); waiting_to_start = false; @@ -218,7 +215,6 @@ Session::first_stage_init (string fullpath, string snapshot_name) waveforms for clicks. */ - _click_io = 0; _clicking = false; click_requested = false; click_data = 0; @@ -1417,10 +1413,10 @@ Session::state(bool full_state) child = node->add_child ("Routes"); { - Glib::RWLock::ReaderLock lm (route_lock); + boost::shared_ptr r = routes.reader (); RoutePublicOrderSorter cmp; - RouteList public_order(routes); + RouteList public_order (*r); public_order.sort (cmp); for (RouteList::iterator i = public_order.begin(); i != public_order.end(); ++i) { @@ -1716,7 +1712,6 @@ Session::load_routes (const XMLNode& node) { XMLNodeList nlist; XMLNodeConstIterator niter; - Route *route; nlist = node.children(); @@ -1724,7 +1719,9 @@ Session::load_routes (const XMLNode& node) for (niter = nlist.begin(); niter != nlist.end(); ++niter) { - if ((route = XMLRouteFactory (**niter)) == 0) { + boost::shared_ptr route (XMLRouteFactory (**niter)); + + if (route == 0) { error << _("Session: cannot create Route from XML description.") << endmsg; return -1; } @@ -1735,11 +1732,11 @@ Session::load_routes (const XMLNode& node) return 0; } -Route * +boost::shared_ptr Session::XMLRouteFactory (const XMLNode& node) { if (node.name() != "Route") { - return 0; + return boost::shared_ptr ((Route*) 0); } bool has_diskstream = (node.property ("diskstream") != 0 || node.property ("diskstream-id") != 0); @@ -1752,12 +1749,16 @@ Session::XMLRouteFactory (const XMLNode& node) assert(type != Buffer::NIL); if (has_diskstream) { - if (type == Buffer::AUDIO) - return new AudioTrack (*this, node); - else - return new MidiTrack (*this, node); + if (type == Buffer::AUDIO) { + boost::shared_ptr ret (new AudioTrack (*this, node)); + return ret; + } else { + boost::shared_ptr ret (new MidiTrack (*this, node)); + return ret; + } } else { - return new Route (*this, node); + boost::shared_ptr ret (new Route (*this, node)); + return ret; } } @@ -2441,23 +2442,6 @@ Session::load_route_groups (const XMLNode& node, bool edit) return 0; } -void -Session::swap_configuration(Configuration** new_config) -{ - Glib::RWLock::WriterLock lm (route_lock); // jlc - WHY? - Configuration* tmp = *new_config; - *new_config = Config; - Config = tmp; - set_dirty(); -} - -void -Session::copy_configuration(Configuration* new_config) -{ - Glib::RWLock::WriterLock lm (route_lock); - new_config = new Configuration(*Config); -} - static bool state_file_filter (const string &str, void *arg) { @@ -2481,7 +2465,7 @@ remove_end(string* state) statename = statename.substr (start+1); } - if ((end = statename.rfind(".ardour")) < 0) { + if ((end = statename.rfind(".ardour")) == string::npos) { end = statename.length(); } @@ -2633,14 +2617,15 @@ Session::GlobalRouteBooleanState Session::get_global_route_boolean (bool (Route::*method)(void) const) { GlobalRouteBooleanState s; - Glib::RWLock::ReaderLock lm (route_lock); + boost::shared_ptr r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->hidden()) { RouteBooleanState v; v.first =* i; - v.second = ((*i)->*method)(); + Route* r = (*i).get(); + v.second = (r->*method)(); s.push_back (v); } @@ -2653,9 +2638,9 @@ Session::GlobalRouteMeterState Session::get_global_route_metering () { GlobalRouteMeterState s; - Glib::RWLock::ReaderLock lm (route_lock); + boost::shared_ptr r = routes.reader (); - for (RouteList::iterator i = routes.begin(); i != routes.end(); ++i) { + for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->hidden()) { RouteMeterState v; @@ -2681,7 +2666,8 @@ void Session::set_global_route_boolean (GlobalRouteBooleanState s, void (Route::*method)(bool, void*), void* arg) { for (GlobalRouteBooleanState::iterator i = s.begin(); i != s.end(); ++i) { - (i->first->*method) (i->second, arg); + Route* r = i->first.get(); + (r->*method) (i->second, arg); } } @@ -3285,6 +3271,10 @@ Session::add_controllable (Controllable* c) void Session::remove_controllable (Controllable* c) { + if (_state_of_the_state | Deletion) { + return; + } + Glib::Mutex::Lock lm (controllables_lock); controllables.remove (c); } @@ -3302,3 +3292,10 @@ Session::controllable_by_id (const PBD::ID& id) return 0; } + +void +Session::add_instant_xml (XMLNode& node, const std::string& dir) +{ + Stateful::add_instant_xml (node, dir); + Config->add_instant_xml (node, get_user_ardour_path()); +}