Fix wrongly exposed set_parameter methods on PluginInsert.
authorDavid Robillard <d@drobilla.net>
Mon, 13 Oct 2008 17:29:22 +0000 (17:29 +0000)
committerDavid Robillard <d@drobilla.net>
Mon, 13 Oct 2008 17:29:22 +0000 (17:29 +0000)
Have plugin GUI stuff twiddle plugin parameters correctly.

git-svn-id: svn://localhost/ardour2/branches/3.0@3957 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/generic_pluginui.cc
libs/ardour/ardour/automatable.h
libs/ardour/ardour/panner.h
libs/ardour/ardour/plugin_insert.h
libs/ardour/automatable.cc

index 56fa8483b7ad66db2d3466d5ff61a7c747cf8cc1..a42aa6b9bcf20fb04254faa0fc519bacad0dd6e2 100644 (file)
@@ -683,7 +683,7 @@ void
 GenericPluginUI::control_port_toggled (ControlUI* cui)
 {
        if (!cui->ignore_change) {
-               insert->set_parameter (cui->parameter(), cui->button->get_active());
+               insert->automation_control(cui->parameter())->set_value(cui->button->get_active());
        }
 }
 
@@ -693,9 +693,8 @@ GenericPluginUI::control_combo_changed (ControlUI* cui)
        if (!cui->ignore_change) {
                string value = cui->combo->get_active_text();
                std::map<string,float> mapping = *cui->combo_map;
-               insert->set_parameter (cui->parameter(), mapping[value]);
+               insert->automation_control(cui->parameter())->set_value(mapping[value]);
        }
-
 }
 
 void
index 8cfadec638ace9eb9cefa90da3029c8bd0d8819b..fc61e2200d563852f7c3872474e96945062e6059 100644 (file)
@@ -50,6 +50,12 @@ public:
        boost::shared_ptr<Evoral::Control>
        control_factory(const Evoral::Parameter& id);
 
+       boost::shared_ptr<AutomationControl>
+       automation_control (const Evoral::Parameter& id, bool create_if_missing=false);
+       
+       boost::shared_ptr<const AutomationControl>
+       automation_control (const Evoral::Parameter& id) const;
+
        virtual void add_control(boost::shared_ptr<Evoral::Control>);
        
        virtual void automation_snapshot(nframes_t now, bool force);
index 7019f5e5ac9dee05fceb2f7a26a10bdcdd925278..f523f431c423054addd20c75f0d2c1ad24272bb0 100644 (file)
@@ -290,12 +290,12 @@ class Panner : public Processor
            float get_value (void) const;
        };
 
-       boost::shared_ptr<AutomationControl> pan_control ( int id, int chan=0 ) {
-           return boost::dynamic_pointer_cast<AutomationControl>( control( Evoral::Parameter (PanAutomation, chan, id) ));
+       boost::shared_ptr<AutomationControl> pan_control (int id, int chan=0) {
+           return automation_control(Evoral::Parameter (PanAutomation, chan, id));
        }
 
-       boost::shared_ptr<const AutomationControl> pan_control ( int id, int chan=0 ) const {
-           return boost::dynamic_pointer_cast<const AutomationControl>( control( Evoral::Parameter (PanAutomation, chan, id) ));
+       boost::shared_ptr<const AutomationControl> pan_control (int id, int chan=0) const {
+           return automation_control(Evoral::Parameter (PanAutomation, chan, id));
        }
 
   private:
index 25a9e52e88f81f3dc0ace87b0ae740c72d8c9e08..d83b41d1e0d3a67f50b5516e8923d6c4491b94a7 100644 (file)
@@ -74,11 +74,6 @@ class PluginInsert : public Processor
 
        bool is_generator() const;
 
-       void  set_parameter (Evoral::Parameter param, float val);
-       float get_parameter (Evoral::Parameter param);
-
-       float default_parameter_value (const Evoral::Parameter& param);
-       
        struct PluginControl : public AutomationControl 
        {
            PluginControl (PluginInsert* p, const Evoral::Parameter &param,
@@ -111,6 +106,11 @@ class PluginInsert : public Processor
 
        void parameter_changed (Evoral::Parameter, float);
        
+       void  set_parameter (Evoral::Parameter param, float val);
+       float get_parameter (Evoral::Parameter param);
+
+       float default_parameter_value (const Evoral::Parameter& param);
+       
        std::vector<boost::shared_ptr<Plugin> > _plugins;
        
        void automation_run (BufferSet& bufs, nframes_t nframes, nframes_t offset);
index c145c3c50129520a2cd552b7b01bbf0cc13b25b1..6daeb996693e54cc7d364729ed0221bbde70df0a 100644 (file)
@@ -417,3 +417,15 @@ Automatable::control_factory(const Evoral::Parameter& param)
        return boost::shared_ptr<Evoral::Control>(control);
 }
 
+boost::shared_ptr<AutomationControl>
+Automatable::automation_control (const Evoral::Parameter& id, bool create)
+{
+       return boost::dynamic_pointer_cast<AutomationControl>(Evoral::ControlSet::control(id, create));
+}
+
+boost::shared_ptr<const AutomationControl>
+Automatable::automation_control (const Evoral::Parameter& id) const
+{
+       return boost::dynamic_pointer_cast<const AutomationControl>(Evoral::ControlSet::control(id));
+}
+