add a back-pointer to the owner of a Processor
authorPaul Davis <paul@linuxaudiosystems.com>
Mon, 14 Oct 2013 15:12:50 +0000 (11:12 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Mon, 14 Oct 2013 15:12:50 +0000 (11:12 -0400)
Use SessionObject* rather than Route so that per-region plugins will be possible in the future.

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

index 772ae3520dc60d3bb15abdfd059819858a5aa8eb..18f13dbc7806188fa8e8acc4b9bfdeaa51ed5e85 100644 (file)
@@ -113,6 +113,9 @@ class Processor : public SessionObject, public Automatable, public Latent
        void  set_ui (void*);
        void* get_ui () const { return _ui_pointer; }
 
+        void set_owner (SessionObject*);
+        SessionObject* owner() const;
+
 protected:
        virtual int set_state_2X (const XMLNode&, int version);
 
@@ -125,6 +128,7 @@ protected:
        bool      _display_to_user;
        bool      _pre_fader; ///< true if this processor is currently placed before the Amp, otherwise false
        void*     _ui_pointer;
+        SessionObject* _owner;
 };
 
 } // namespace ARDOUR
index 3f8fdf509d08eed5767d0e48c44ddb569e4b8ec3..f9590bee117ed12ad4356f2f35f128279688cac5 100644 (file)
@@ -269,3 +269,15 @@ Processor::set_ui (void* p)
 {
        _ui_pointer = p;
 }
+
+void
+Processor::set_owner (SessionObject* o)
+{
+       _owner = o;
+}
+
+SessionObject*
+Processor::owner() const
+{
+       return _owner;
+}
index d0b2260c3d7094ff1e9ec1b3002f0f6752231588..f6af17b1b885cedceb37b4b54679bcc6f81696bc 100644 (file)
@@ -149,6 +149,7 @@ Route::init ()
        */
 
        _meter.reset (new PeakMeter (_session, _name));
+       _meter->set_owner (this);
        _meter->set_display_to_user (false);
        _meter->activate ();
 
@@ -1011,6 +1012,7 @@ Route::add_processor (boost::shared_ptr<Processor> processor, boost::shared_ptr<
                }
 
                _processors.insert (loc, processor);
+               processor->set_owner (this);
 
                // Set up processor list channels.  This will set processor->[input|output]_streams(),
                // configure redirect ports properly, etc.
@@ -1161,6 +1163,7 @@ Route::add_processors (const ProcessorList& others, boost::shared_ptr<Processor>
                        }
 
                        _processors.insert (loc, *i);
+                       (*i)->set_owner (this);
 
                        if ((*i)->active()) {
                                (*i)->activate ();
@@ -2616,6 +2619,7 @@ Route::set_processor_state (const XMLNode& node)
 
                for (ProcessorList::const_iterator i = _processors.begin(); i != _processors.end(); ++i) {
 
+                       (*i)->set_owner (this);
                        (*i)->ActiveChanged.connect_same_thread (*this, boost::bind (&Session::update_latency_compensation, &_session, false));
 
                        boost::shared_ptr<PluginInsert> pi;