fix clicking when processors become active/inactive; reduce crazy 2.5sec delay for...
authorPaul Davis <paul@linuxaudiosystems.com>
Tue, 21 Jul 2009 14:39:21 +0000 (14:39 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 21 Jul 2009 14:39:21 +0000 (14:39 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@5402 d708f5d6-7413-0410-9779-e7cbd77b26cf

20 files changed:
gtk2_ardour/ardour_ui.cc
gtk2_ardour/gain_meter.cc
gtk2_ardour/gain_meter.h
gtk2_ardour/mixer_strip.cc
gtk2_ardour/processor_box.cc
gtk2_ardour/return_ui.cc
gtk2_ardour/route_time_axis.cc
gtk2_ardour/send_ui.cc
gtk2_ardour/sfdb_ui.cc
libs/ardour/amp.cc
libs/ardour/ardour/processor.h
libs/ardour/delivery.cc
libs/ardour/internal_return.cc
libs/ardour/internal_send.cc
libs/ardour/meter.cc
libs/ardour/plugin_insert.cc
libs/ardour/port_insert.cc
libs/ardour/processor.cc
libs/ardour/return.cc
libs/ardour/send.cc

index 1335dce36f20a0379a2dd9d496ac231fe2529c50..2a2b3cc10b522132650aad225805fb95b37e9d5b 100644 (file)
@@ -733,7 +733,7 @@ ARDOUR_UI::finish()
 
                if (session->transport_rolling()) {
                        session->request_stop ();
-                       usleep (2500000);
+                       usleep (250000);
                }
 
                if (session->dirty()) {
index 6ed8893752ecf3ceaeb30903467896e64817d74c..e6f0c7404221f5bdf6fd37372dd29056d453e8ce 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <limits.h>
 
+#include "ardour/amp.h"
 #include "ardour/io.h"
 #include "ardour/route.h"
 #include "ardour/route_group.h"
@@ -162,27 +163,26 @@ GainMeterBase::~GainMeterBase ()
 void
 GainMeterBase::set_controls (boost::shared_ptr<Route> r,
                             boost::shared_ptr<PeakMeter> pm, 
-                            boost::shared_ptr<AutomationControl> gc,
-                            boost::shared_ptr<Automatable> gc_owner)
+                            boost::shared_ptr<Amp> amp)
 {
        connections.clear ();
 
-       if (!pm && !gc) {
+       if (!pm && !amp) {
                level_meter->set_meter (0);
                gain_slider->set_controllable (boost::shared_ptr<PBD::Controllable>());
                _meter.reset ();
-               _gain_control.reset ();
+               _amp.reset ();
                _route.reset ();
                return;
        } 
 
        _meter = pm;
-       _gain_control = gc;
+       _amp = amp;
        _route = r;
 
        level_meter->set_meter (pm.get());
-       gain_slider->set_controllable (gc);
-       
+       gain_slider->set_controllable (amp->gain_control());
+       
        if (!_route || !_route->is_hidden()) {
                
                using namespace Menu_Helpers;
@@ -190,28 +190,30 @@ GainMeterBase::set_controls (boost::shared_ptr<Route> r,
                gain_astate_menu.items().clear ();
                
                gain_astate_menu.items().push_back (MenuElem (_("Manual"), 
-                                                             bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state),
+                                                             bind (mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
                                                                    Evoral::Parameter(GainAutomation), (AutoState) Off)));
                gain_astate_menu.items().push_back (MenuElem (_("Play"),
-                                                             bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state),
+                                                             bind (mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
                                                                    Evoral::Parameter(GainAutomation), (AutoState) Play)));
                gain_astate_menu.items().push_back (MenuElem (_("Write"),
-                                                             bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state),
+                                                             bind (mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
                                                                    Evoral::Parameter(GainAutomation), (AutoState) Write)));
                gain_astate_menu.items().push_back (MenuElem (_("Touch"),
-                                                             bind (mem_fun (*(gc_owner.get()), &Automatable::set_parameter_automation_state),
+                                                             bind (mem_fun (*(amp.get()), &Automatable::set_parameter_automation_state),
                                                                    Evoral::Parameter(GainAutomation), (AutoState) Touch)));
                
                connections.push_back (gain_automation_style_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_style_button_event), false));
                connections.push_back (gain_automation_state_button.signal_button_press_event().connect (mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false));
-               
+
+               boost::shared_ptr<AutomationControl> gc = amp->gain_control();
+
                connections.push_back (gc->alist()->automation_state_changed.connect (mem_fun(*this, &GainMeter::gain_automation_state_changed)));
                connections.push_back (gc->alist()->automation_style_changed.connect (mem_fun(*this, &GainMeter::gain_automation_style_changed)));
                
                gain_automation_state_changed ();
        }
 
-       connections.push_back (gc->Changed.connect (mem_fun (*this, &GainMeterBase::gain_changed)));
+       connections.push_back (amp->gain_control()->Changed.connect (mem_fun (*this, &GainMeterBase::gain_changed)));
 
        gain_changed ();
        show_gain ();
@@ -344,7 +346,7 @@ GainMeterBase::gain_activated ()
 
                f = min (f, 6.0f);
 
-               _gain_control->set_value (dB_to_coefficient(f));
+               _amp->set_gain (dB_to_coefficient(f), this);
 
                if (gain_display.has_focus()) {
                        PublicEditor::instance().reset_focus();
@@ -372,7 +374,13 @@ void
 GainMeterBase::gain_adjusted ()
 {
        if (!ignore_toggle) {
-               _gain_control->set_value (slider_position_to_gain (gain_adjustment.get_value()));
+               if (_route) {
+                       if (_route->amp() == _amp) {
+                               _route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this);
+                       } else {
+                               _amp->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this);
+                       }
+               }
        }
 
        show_gain ();
@@ -381,7 +389,7 @@ GainMeterBase::gain_adjusted ()
 void
 GainMeterBase::effective_gain_display ()
 {
-       gfloat value = gain_to_slider_position (_gain_control->get_value());
+       gfloat value = gain_to_slider_position (_amp->gain());
        
        //cerr << this << " for " << _io->name() << " EGAIN = " << value
        //              << " AGAIN = " << gain_adjustment.get_value () << endl;
@@ -415,7 +423,7 @@ GainMeterBase::set_fader_name (const char * name)
 void
 GainMeterBase::update_gain_sensitive ()
 {
-       bool x = !(_gain_control->alist()->automation_state() & Play);
+       bool x = !(_amp->gain_control()->alist()->automation_state() & Play);
        static_cast<Gtkmm2ext::SliderController*>(gain_slider)->set_sensitive (x);
 }
 
@@ -557,14 +565,14 @@ GainMeterBase::meter_point_clicked ()
 gint
 GainMeterBase::start_gain_touch (GdkEventButton* ev)
 {
-       _gain_control->start_touch ();
+       _amp->gain_control()->start_touch ();
        return FALSE;
 }
 
 gint
 GainMeterBase::end_gain_touch (GdkEventButton* ev)
 {
-       _gain_control->stop_touch ();
+       _amp->gain_control()->stop_touch ();
        return FALSE;
 }
 
@@ -667,10 +675,10 @@ GainMeterBase::gain_automation_style_changed ()
 {
        switch (_width) {
        case Wide:
-               gain_automation_style_button.set_label (astyle_string(_gain_control->alist()->automation_style()));
+               gain_automation_style_button.set_label (astyle_string(_amp->gain_control()->alist()->automation_style()));
                break;
        case Narrow:
-               gain_automation_style_button.set_label  (short_astyle_string(_gain_control->alist()->automation_style()));
+               gain_automation_style_button.set_label  (short_astyle_string(_amp->gain_control()->alist()->automation_style()));
                break;
        }
 }
@@ -684,14 +692,14 @@ GainMeterBase::gain_automation_state_changed ()
 
        switch (_width) {
        case Wide:
-               gain_automation_state_button.set_label (astate_string(_gain_control->alist()->automation_state()));
+               gain_automation_state_button.set_label (astate_string(_amp->gain_control()->alist()->automation_state()));
                break;
        case Narrow:
-               gain_automation_state_button.set_label (short_astate_string(_gain_control->alist()->automation_state()));
+               gain_automation_state_button.set_label (short_astate_string(_amp->gain_control()->alist()->automation_state()));
                break;
        }
 
-       x = (_gain_control->alist()->automation_state() != Off);
+       x = (_amp->gain_control()->alist()->automation_state() != Off);
        
        if (gain_automation_state_button.get_active() != x) {
                ignore_toggle = true;
@@ -795,8 +803,7 @@ GainMeter::GainMeter (Session& s)
 void 
 GainMeter::set_controls (boost::shared_ptr<Route> r,
                         boost::shared_ptr<PeakMeter> meter,
-                        boost::shared_ptr<AutomationControl> gain_control,
-                        boost::shared_ptr<Automatable> gc_owner)
+                        boost::shared_ptr<Amp> amp)
 {
        if (level_meter->get_parent()) {
                hbox.remove (*level_meter);
@@ -810,7 +817,7 @@ GainMeter::set_controls (boost::shared_ptr<Route> r,
                fader_vbox->remove (gain_automation_state_button);
        }
 
-       GainMeterBase::set_controls (r, meter, gain_control, gc_owner);
+       GainMeterBase::set_controls (r, meter, amp);
 
        /* 
           if we have a non-hidden route (ie. we're not the click or the auditioner), 
@@ -915,7 +922,11 @@ GainMeter::meter_metrics_expose (GdkEventExpose *ev)
 boost::shared_ptr<PBD::Controllable>
 GainMeterBase::get_controllable()
 {
-       return _gain_control;
+       if (_amp) {
+               return _amp->gain_control();
+       } else {
+               return boost::shared_ptr<PBD::Controllable>();
+       }
 }
 
 
index 7feaf5c0e4192e150262b4452ede5f85d32ce36d..4ce13af0d606da405ae74959b710533a567709a8 100644 (file)
@@ -47,6 +47,7 @@ namespace ARDOUR {
        class Route;
        class RouteGroup;
        class PeakMeter;
+       class Amp;
        class Automatable;
 }
 namespace Gtkmm2ext {
@@ -66,8 +67,7 @@ class GainMeterBase : virtual public sigc::trackable
 
        virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
                                   boost::shared_ptr<ARDOUR::PeakMeter> meter,
-                                  boost::shared_ptr<ARDOUR::AutomationControl> gain_control,
-                                  boost::shared_ptr<ARDOUR::Automatable> gc_owner);
+                                  boost::shared_ptr<ARDOUR::Amp> amp);
 
        void update_gain_sensitive ();
        void update_meters ();
@@ -89,7 +89,7 @@ class GainMeterBase : virtual public sigc::trackable
        friend class MixerStrip;
        boost::shared_ptr<ARDOUR::Route> _route;
        boost::shared_ptr<ARDOUR::PeakMeter> _meter;
-       boost::shared_ptr<ARDOUR::AutomationControl> _gain_control;
+       boost::shared_ptr<ARDOUR::Amp> _amp;
        ARDOUR::Session& _session;
        std::vector<sigc::connection> connections;
 
@@ -184,8 +184,7 @@ class GainMeter : public GainMeterBase, public Gtk::VBox
 
        virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
                                   boost::shared_ptr<ARDOUR::PeakMeter> meter,
-                                  boost::shared_ptr<ARDOUR::AutomationControl> gain_control,
-                                  boost::shared_ptr<ARDOUR::Automatable> gc_owner);
+                                  boost::shared_ptr<ARDOUR::Amp> amp);
 
        int get_gm_width ();
        void setup_meters (int len=0);
index b18e1699b26287d4b3498977095c6c5636863b34..7d6257bbd0006d85e2b84496a84bd06836b4abf5 100644 (file)
@@ -343,7 +343,7 @@ MixerStrip::set_route (boost::shared_ptr<Route> rt)
        _current_delivery = _route->main_outs ();
 
        panners.set_panner (rt->main_outs()->panner());
-       gpm.set_controls (rt, rt->shared_peak_meter(), rt->gain_control(), rt->amp());
+       gpm.set_controls (rt, rt->shared_peak_meter(), rt->amp());
        processor_box.set_route (rt);
 
        if (set_color_from_route()) {
@@ -1419,12 +1419,12 @@ MixerStrip::switch_io (boost::shared_ptr<Route> target)
                send = boost::dynamic_pointer_cast<Send>(_current_delivery);
                send->set_metering (true);
                _current_delivery->GoingAway.connect (mem_fun (*this, &MixerStrip::revert_to_default_display));
-               gain_meter().set_controls (_route, send->meter(), send->amp()->gain_control(), send->amp());
+               gain_meter().set_controls (_route, send->meter(), send->amp());
                panner_ui().set_panner (_current_delivery->panner());
 
        } else {
                _current_delivery = _route->main_outs ();
-               gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->gain_control(), _route->amp());
+               gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
                panner_ui().set_panner (_route->main_outs()->panner());
        }
        
@@ -1446,7 +1446,7 @@ MixerStrip::revert_to_default_display ()
        
        _current_delivery = _route->main_outs();
 
-       gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->gain_control(), _route->amp());
+       gain_meter().set_controls (_route, _route->shared_peak_meter(), _route->amp());
        gain_meter().setup_meters ();
        panner_ui().set_panner (_route->main_outs()->panner());
        panner_ui().setup_pan ();
index 7b7d18f7e73acb779c475b6abf74de108ce8f8cf..5f4762c18c02af087dbebb383ed0db8ea787e25a 100644 (file)
@@ -1383,7 +1383,7 @@ ProcessorBox::edit_processor (boost::shared_ptr<Processor> processor)
                gidget = send_ui;
 #else
                if (_parent_strip) {
-                       _parent_strip->gain_meter().set_controls (_route, send->meter(), send->amp()->gain_control(), send->amp());
+                       _parent_strip->gain_meter().set_controls (_route, send->meter(), send->amp());
                        _parent_strip->panner_ui().set_panner (send->panner());
                }
 #endif
index 155a1095c1ef4b9c5be6ca1ad92f826e6cc2dde2..5d2e2d982673bc2fd2cabf9282efd2c6345d1f01 100644 (file)
@@ -38,7 +38,7 @@ ReturnUI::ReturnUI (boost::shared_ptr<Return> r, Session& se)
        , _session (se)
        , _gpm (se)
 {
-       _gpm.set_controls (boost::shared_ptr<Route>(), r->meter(), r->amp()->gain_control(), r->amp());
+       _gpm.set_controls (boost::shared_ptr<Route>(), r->meter(), r->amp());
 
        _hbox.pack_start (_gpm, true, true);
        set_name ("ReturnUIFrame");
index 87ba46ffb64b7938590161048f2cd57ca8ab3723..11be3086e53dab6f32512d84ae013976f01822e8 100644 (file)
@@ -114,7 +114,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
 {
        set_button_names ();
 
-       gm.set_controls (_route, _route->shared_peak_meter(), _route->gain_control(), _route->amp());
+       gm.set_controls (_route, _route->shared_peak_meter(), _route->amp());
        gm.get_level_meter().set_no_show_all();
        gm.get_level_meter().setup_meters(50);
 
index 19baaa7f9319716796acd2edd191598b6b04fc24..9192765999dd5535a8ae212de4589f02d6f736cd 100644 (file)
@@ -40,7 +40,7 @@ SendUI::SendUI (boost::shared_ptr<Send> s, Session& se)
        , _panners (se)
 {
        _panners.set_panner (s->panner());
-       _gpm.set_controls (boost::shared_ptr<Route>(), s->meter(), s->amp()->gain_control(), s->amp());
+       _gpm.set_controls (boost::shared_ptr<Route>(), s->meter(), s->amp());
 
        _hbox.pack_start (_gpm, true, true);
        set_name ("SendUIFrame");
index 817c710fd80960c205acda856be1b1c47c850ae1..e0caced97ac5245fcb0fb8b29a204f51ee1c377b 100644 (file)
@@ -598,7 +598,7 @@ SoundFileBrowser::add_gain_meter ()
 
        boost::shared_ptr<Route> r = session->the_auditioner ();
 
-       gm->set_controls (r, r->shared_peak_meter(), r->gain_control(), r->amp());
+       gm->set_controls (r, r->shared_peak_meter(), r->amp());
 
        meter_packer.set_border_width (12);
        meter_packer.pack_start (*gm, false, true);
index 9aa88068a95052b419fdbf50798775e5c1b725b2..cc63353886214cfc953d7e04bf985dde9ce63496 100644 (file)
@@ -75,7 +75,7 @@ Amp::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t
 {
        gain_t mute_gain;
 
-       if (!_active) {
+       if (!_active && !_pending_active) {
                return;
        }
 
@@ -159,6 +159,8 @@ Amp::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t
                        } 
                }
        }
+
+       _active = _pending_active;
 }
 
 void
index 2df10e9c6902b4e1c347fbd4be5f53cd18ba5d20..a97dcc4cf752fbfa55ea34bd9c326f6e2cc1e316 100644 (file)
@@ -59,7 +59,7 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
        virtual bool visible() const { return true; }
        virtual void set_visible (bool) {}
 
-       bool active () const { return _active; }
+       bool active () const { return _pending_active; }
 
        bool get_next_ab_is_active () const { return _next_ab_is_active; }
        void set_next_ab_is_active (bool yn) { _next_ab_is_active = yn; }
@@ -73,8 +73,8 @@ class Processor : public SessionObject, public AutomatableControls, public Laten
        virtual void run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes) {}
        virtual void silence (nframes_t nframes) {}
        
-       virtual void activate ()   { _active = true; ActiveChanged(); }
-       virtual void deactivate () { _active = false; ActiveChanged(); }
+       virtual void activate ()   { _pending_active = true; ActiveChanged(); }
+       virtual void deactivate () { _pending_active = false; ActiveChanged(); }
        
        virtual bool configure_io (ChanCount in, ChanCount out);
 
index efe123c059cde652862ab13d86f8326ce5ea8a00..aff082f09631b121cc441a3351ffc9437a7580a9 100644 (file)
@@ -280,15 +280,22 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra
 {
        assert (_output);
 
-       if (!_active || _output->n_ports ().get (_output->default_type()) == 0) {
-               return;
+       PortSet& ports (_output->ports());
+       gain_t tgain;
+
+       if (_output->n_ports ().get (_output->default_type()) == 0) {
+               goto out;
+       }
+
+       if (!_active && !_pending_active) {
+               _output->silence (nframes);
+               goto out;
        }
 
        /* this setup is not just for our purposes, but for anything that comes after us in the 
           processing pathway that wants to use this->output_buffers() for some reason.
        */
 
-       PortSet& ports (_output->ports());
        output_buffers().attach_buffers (ports, nframes, _output_offset);
 
        // this Delivery processor is not a derived type, and thus we assume
@@ -296,7 +303,7 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra
        // the main output stage of a Route). Contrast with Send::run()
        // which cannot do this.
 
-       gain_t tgain = target_gain ();
+       tgain = target_gain ();
        
        if (tgain != _current_gain) {
                
@@ -310,11 +317,10 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra
                /* we were quiet last time, and we're still supposed to be quiet.
                   Silence the outputs, and make sure the buffers are quiet too,
                */
-
+               
                _output->silence (nframes);
                Amp::apply_simple_gain (bufs, nframes, 0.0);
-               
-               return;
+               goto out;
 
        } else if (tgain != 1.0) {
 
@@ -341,6 +347,9 @@ Delivery::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfra
                        _output->copy_to_outputs (bufs, DataType::MIDI, nframes, _output_offset);
                }
        }
+
+  out:
+       _active = _pending_active;
 }
 
 XMLNode&
@@ -495,6 +504,12 @@ Delivery::flush (nframes_t nframes)
 gain_t
 Delivery::target_gain ()
 {
+       /* if we've been requested to deactivate, our target gain is zero */
+
+       if (!_pending_active) {
+               return 0.0;
+       }
+
        /* if we've been told not to output because its a monitoring situation and
           we're not monitoring, then be quiet.
        */
index 37a559649caae842efeb07d22900eb23bb23faf4..f6c99d85184946ce16810f0dc94af9b6e7e54fdf 100644 (file)
@@ -46,7 +46,11 @@ InternalReturn::InternalReturn (Session& s, const XMLNode& node)
 void
 InternalReturn::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
 {
-       /* XXX no lock here, just atomic fetch */
+       if (!_active && !_pending_active) {
+               return;
+       }
+
+       /* no lock here, just atomic fetch */
 
        if (g_atomic_int_get(&user_count) == 0) {
                /* nothing to do - nobody is feeding us anything */
@@ -54,6 +58,7 @@ InternalReturn::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame
        }
 
        bufs.merge_from (buffers, nframes);
+       _active = _pending_active;
 }
 
 bool
index 7ca9319a1e74de99ec9e615e558d94b64bbf2bc1..7c2c3842761aa83ed4eaa703448cd2539cbbf20c 100644 (file)
@@ -72,7 +72,7 @@ InternalSend::send_to_going_away ()
 void
 InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
 {
-       if (!_active || !target || !_send_to) {
+       if ((!_active && !_pending_active) || !target || !_send_to) {
                _meter->reset ();
                return;
        }
@@ -102,7 +102,7 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
 
                _meter->reset ();
                Amp::apply_simple_gain (sendbufs, nframes, 0.0);
-               return;
+               goto out;
 
        } else if (tgain != 1.0) {
 
@@ -130,6 +130,9 @@ InternalSend::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
        /* deliver to target */
 
        target->merge_from (sendbufs, nframes);
+
+  out:
+       _active = _pending_active;
 }
 
 bool
index ba5ccf15010ace32ae09026375b9a70782e17c32..e8512aa5932706ffb09bbde0dfa7545dfb6ba111 100644 (file)
@@ -73,7 +73,7 @@ Metering::update_meters()
 void
 PeakMeter::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
 {
-       if (!_active) {
+       if (!_active && !_pending_active) {
                return;
        }
 
@@ -111,6 +111,8 @@ PeakMeter::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nfr
        for (uint32_t i = n; i < _peak_power.size(); ++i) {
                _peak_power[i] = 0.0f;
        }
+
+       _active = _pending_active;
 }
 
 PeakMeter::PeakMeter (Session& s, const XMLNode& node)
index 461a3f0685986a819ac5dbd0ce2ba8c4c23bbcc5..8f7eae58493cb2d1dcc12d6597c33e086ee289e9 100644 (file)
@@ -377,13 +377,14 @@ PluginInsert::silence (nframes_t nframes)
 void
 PluginInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
 {
-       if (active()) {
+       if (_active || _pending_active) {
 
                if (_session.transport_rolling()) {
                        automation_run (bufs, nframes);
                } else {
                        connect_and_run (bufs, nframes, 0, false);
                }
+
        } else {
 
                /* FIXME: type, audio only */
@@ -402,6 +403,8 @@ PluginInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame,
 
                bufs.count().set_audio(out);
        }
+
+       _active = _pending_active;
 }
 
 void
index ffddc681c76802ca901741b470cc719dcf6da12f..a46f7a7da3ea5188721e6c5225fbbff8dc9dc95b 100644 (file)
@@ -72,14 +72,17 @@ PortInsert::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nf
                return;
        }
 
-       if (!active()) {
+       if (!_active && !_pending_active) {
                /* deliver silence */
                silence (nframes);
-               return;
+               goto out;
        }
 
        _out->run (bufs, start_frame, end_frame, nframes);
        _input->collect_input (bufs, nframes, ChanCount::ZERO);
+
+  out:
+       _active = _pending_active;
 }
 
 XMLNode&
index e3a2b0b15ef5caf361e821d6f5326be75d5b4546..04706c0c2def6a8674bc1ab24ff9c4321f735c55 100644 (file)
@@ -65,6 +65,7 @@ const string Processor::state_node_name = "Processor";
 Processor::Processor(Session& session, const string& name)
        : SessionObject(session, name)
        , AutomatableControls(session)
+       , _pending_active(false)
        , _active(false)
        , _next_ab_is_active(false)
        , _configured(false)
@@ -75,12 +76,14 @@ Processor::Processor(Session& session, const string& name)
 Processor::Processor (Session& session, const XMLNode& node)
        : SessionObject(session, "renameMe")
        , AutomatableControls(session)
+       , _pending_active(false)
        , _active(false)
        , _next_ab_is_active(false)
        , _configured(false)
        , _gui(0)
 {
        set_state (node);
+       _pending_active = _active;
 }
 
 XMLNode&
index 5a44d3f6e67814ed293ffbe201af9a155c82c580..e5af719afdb7226cbe468afeb9f606aa9bacc6f9 100644 (file)
@@ -122,7 +122,7 @@ Return::set_state(const XMLNode& node)
 void
 Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
 {
-       if (!active() || _input->n_ports() == ChanCount::ZERO) {
+       if ((!_active && !_pending_active) || _input->n_ports() == ChanCount::ZERO) {
                return;
        }
        
@@ -141,6 +141,8 @@ Return::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframe
                        _meter->run (bufs, start_frame, end_frame, nframes);
                }
        }
+
+       _active = _pending_active;
 }
 
 bool
index ea4c16a416f04ded663236f91bb220b41a709b29..1728dc52d945bb592fc3ca4cee32f332f5f872e1 100644 (file)
@@ -86,8 +86,16 @@ Send::deactivate ()
 void
 Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_t nframes)
 {
-       if (!_active || _output->n_ports() == ChanCount::ZERO) {
+       if (_output->n_ports() == ChanCount::ZERO) {
                _meter->reset ();
+               _active = _pending_active;
+               return;
+       }
+
+       if (!_active && !_pending_active) {
+               _meter->reset ();
+               _output->silence (nframes);
+               _active = _pending_active;
                return;
        }
 
@@ -118,6 +126,8 @@ Send::run (BufferSet& bufs, sframes_t start_frame, sframes_t end_frame, nframes_
                        _meter->run (*_output_buffers, start_frame, end_frame, nframes);
                }
        }
+
+       /* _active was set to _pending_active by Delivery::run() */
 }
 
 XMLNode&