fix #4405, by explicitly cancelling solo when a route's inputs drop to zero
[ardour.git] / libs / ardour / plugin_insert.cc
index aae9278e93e7982417ca8621a08d18c20c8f3cb5..a03c25ee72c2333a9db955ceb22b70bc7462f351 100644 (file)
@@ -94,7 +94,11 @@ PluginInsert::set_count (uint32_t num)
                uint32_t diff = num - _plugins.size();
 
                for (uint32_t n = 0; n < diff; ++n) {
-                       add_plugin_with_activation (plugin_factory (_plugins[0]));
+                       boost::shared_ptr<Plugin> p = plugin_factory (_plugins[0]);
+                       add_plugin (p);
+                       if (active ()) {
+                               p->activate ();
+                       }
 
                        if (require_state) {
                                /* XXX do something */
@@ -136,11 +140,11 @@ PluginInsert::output_streams() const
 
        if (_plugins.front()->reconfigurable_io()) {
                ChanCount out = _plugins.front()->output_streams ();
-               DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, reconfigur(able) output streams = %1\n", out));
+               // DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, reconfigur(able) output streams = %1\n", out));
                return out;
        } else {
                ChanCount out = _plugins.front()->get_info()->n_outputs;
-               DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, static output streams = %1 for %2 plugins\n", out, _plugins.size()));
+               // DEBUG_TRACE (DEBUG::Processors, string_compose ("Plugin insert, static output streams = %1 for %2 plugins\n", out, _plugins.size()));
                out.set_audio (out.n_audio() * _plugins.size());
                out.set_midi (out.n_midi() * _plugins.size());
                return out;
@@ -342,15 +346,6 @@ PluginInsert::connect_and_run (BufferSet& bufs, pframes_t nframes, framecnt_t of
                }
        }
 
-       if (_match.method == Hide) {
-               /* Silence the hidden input buffers */
-               for (DataType::iterator t = DataType::begin(); t != DataType::end(); ++t) {
-                       for (uint32_t i = in_streams.get(*t); i < (in_streams.get(*t) + _match.hide.get(*t)); ++i) {
-                               bufs.get(*t, i).silence (nframes);
-                       }
-               }
-       }
-
        /* Note that we've already required that plugins
           be able to handle in-place processing.
        */
@@ -504,7 +499,7 @@ PluginInsert::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end
         * all buffers appropriately.
         */
 
-       bufs.is_silent (false);
+       bufs.set_is_silent (false);
 }
 
 void
@@ -1166,29 +1161,20 @@ PluginInsert::PluginControl::set_value (double user_val)
 {
        /* FIXME: probably should be taking out some lock here.. */
 
-       double const plugin_val = user_to_plugin (user_val);
-
        for (Plugins::iterator i = _plugin->_plugins.begin(); i != _plugin->_plugins.end(); ++i) {
-               (*i)->set_parameter (_list->parameter().id(), plugin_val);
+               (*i)->set_parameter (_list->parameter().id(), user_val);
        }
 
        boost::shared_ptr<Plugin> iasp = _plugin->_impulseAnalysisPlugin.lock();
        if (iasp) {
-               iasp->set_parameter (_list->parameter().id(), plugin_val);
+               iasp->set_parameter (_list->parameter().id(), user_val);
        }
 
        AutomationControl::set_value (user_val);
 }
 
 double
-PluginInsert::PluginControl::user_to_plugin (double val) const
-{
-       /* no known transformations at this time */
-       return val;
-}
-
-double
-PluginInsert::PluginControl::user_to_ui (double val) const
+PluginInsert::PluginControl::internal_to_interface (double val) const
 {
        if (_logarithmic) {
                if (val > 0) {
@@ -1202,7 +1188,7 @@ PluginInsert::PluginControl::user_to_ui (double val) const
 }
 
 double
-PluginInsert::PluginControl::ui_to_user (double val) const
+PluginInsert::PluginControl::interface_to_internal (double val) const
 {
        if (_logarithmic) {
                val = exp (val);
@@ -1211,20 +1197,6 @@ PluginInsert::PluginControl::ui_to_user (double val) const
        return val;
 }
 
-/** Convert plugin values to UI values.  See pbd/controllable.h */
-double
-PluginInsert::PluginControl::plugin_to_ui (double val) const
-{
-       return user_to_ui (plugin_to_user (val));
-}
-
-double
-PluginInsert::PluginControl::plugin_to_user (double val) const
-{
-       /* no known transformations at this time */
-       return val;
-}
-
 XMLNode&
 PluginInsert::PluginControl::get_state ()
 {
@@ -1242,8 +1214,7 @@ double
 PluginInsert::PluginControl::get_value () const
 {
        /* FIXME: probably should be taking out some lock here.. */
-
-       return plugin_to_user (_plugin->get_parameter (_list->parameter()));
+       return _plugin->get_parameter (_list->parameter());
 }
 
 boost::shared_ptr<Plugin>
@@ -1272,29 +1243,34 @@ PluginInsert::collect_signal_for_analysis (framecnt_t nframes)
        _signal_analysis_collect_nframes_max = nframes;
 }
 
-/** Add a plugin to our list and activate it if we have already been activated */
+/** Add a plugin to our list */
 void
-PluginInsert::add_plugin_with_activation (boost::shared_ptr<Plugin> plugin)
+PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
 {
        plugin->set_insert_info (this);
        _plugins.push_back (plugin);
-       if (active()) {
-               plugin->activate ();
+}
+
+void
+PluginInsert::realtime_handle_transport_stopped ()
+{
+       for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
+               (*i)->realtime_handle_transport_stopped ();
        }
 }
 
-/** Add a plugin to our list */
 void
-PluginInsert::add_plugin (boost::shared_ptr<Plugin> plugin)
+PluginInsert::realtime_locate ()
 {
-       plugin->set_insert_info (this);
-       _plugins.push_back (plugin);
+       for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
+               (*i)->realtime_locate ();
+       }
 }
 
 void
-PluginInsert::realtime_handle_transport_stopped ()
+PluginInsert::monitoring_changed ()
 {
        for (Plugins::iterator i = _plugins.begin(); i != _plugins.end(); ++i) {
-               (*i)->realtime_handle_transport_stopped ();
+               (*i)->monitoring_changed ();
        }
 }