fix crash when copy'ing latent plugins
[ardour.git] / libs / ardour / amp.cc
index 49570bb511226d92c11e26be2bbe248c701c7e05..d86362aa0d37d19198d8a8c840441c8145d133fe 100644 (file)
@@ -31,7 +31,7 @@
 #include "ardour/rc_configuration.h"
 #include "ardour/session.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
 using namespace PBD;
@@ -39,7 +39,7 @@ using namespace PBD;
 // used for low-pass filter denormal protection
 #define GAIN_COEFF_TINY (1e-10) // -200dB
 
-Amp::Amp (Session& s, const std::string& name, boost::shared_ptr<AutomationControl> gc, bool control_midi_also)
+Amp::Amp (Session& s, const std::string& name, boost::shared_ptr<GainControl> gc, bool control_midi_also)
        : Processor(s, "Amp")
        , _apply_gain(true)
        , _apply_gain_automation(false)
@@ -71,7 +71,7 @@ Amp::configure_io (ChanCount in, ChanCount out)
 }
 
 void
-Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, pframes_t nframes, bool)
+Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/, double /*speed*/, pframes_t nframes, bool)
 {
        if (!_active && !_pending_active) {
                return;
@@ -118,7 +118,7 @@ Amp::run (BufferSet& bufs, framepos_t /*start_frame*/, framepos_t /*end_frame*/,
 
                } else { /* manual (scalar) gain */
 
-                       gain_t const dg = _gain_control->user_double();
+                       gain_t const dg = _gain_control->get_value();
 
                        if (_current_gain != dg) {
 
@@ -388,7 +388,7 @@ Amp::setup_gain_automation (framepos_t start_frame, framepos_t end_frame, framec
                assert (_gain_automation_buffer);
                _apply_gain_automation = _gain_control->list()->curve().rt_safe_get_vector (
                        start_frame, end_frame, _gain_automation_buffer, nframes);
-               if (start_frame != _current_automation_frame) {
+               if (start_frame != _current_automation_frame && _session.bounce_processing ()) {
                        _current_gain = _gain_automation_buffer[0];
                }
                _current_automation_frame = end_frame;
@@ -405,7 +405,7 @@ Amp::visible() const
 }
 
 std::string
-Amp::value_as_string (boost::shared_ptr<AutomationControl> ac) const
+Amp::value_as_string (boost::shared_ptr<const AutomationControl> ac) const
 {
        if (ac == _gain_control) {
                char buffer[32];