Allow to get a route reference from SessionObject*
authorRobin Gareus <robin@gareus.org>
Mon, 10 Oct 2016 14:57:20 +0000 (16:57 +0200)
committerRobin Gareus <robin@gareus.org>
Mon, 10 Oct 2016 15:34:18 +0000 (17:34 +0200)
The motivation is to allow a Processor (here Lua) to get a pointer
to the owning Route without resorting to iterative lookup.

libs/ardour/ardour/route.h
libs/ardour/route.cc

index 6c5726339389e3c6591cd19ad9331d6d3a4e741c..ea783cadca88a5fb16a95cf159d2fede8efc3fd9 100644 (file)
@@ -378,6 +378,8 @@ public:
        XMLNode& get_processor_state ();
        virtual void set_processor_state (const XMLNode&);
 
+       boost::weak_ptr<Route> weakroute ();
+
        int save_as_template (const std::string& path, const std::string& name);
 
        PBD::Signal1<void,void*> SelectedChanged;
index 3d34b92d2c2780377327093676ec851aa46ff2de..c15877b28b176aa20507080b064d9699ce26efa0 100644 (file)
@@ -117,6 +117,11 @@ Route::Route (Session& sess, string name, PresentationInfo::Flag flag, DataType
        processor_max_streams.reset();
 }
 
+boost::weak_ptr<Route>
+Route::weakroute () {
+       return boost::weak_ptr<Route> (shared_from_this ());
+}
+
 int
 Route::init ()
 {