Fix wrongly exposed set_parameter methods on PluginInsert.

Have plugin GUI stuff twiddle plugin parameters correctly.


git-svn-id: svn://localhost/ardour2/branches/3.0@3957 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
David Robillard 2008-10-13 17:29:22 +00:00
parent 2065092d25
commit b3634a723d
5 changed files with 29 additions and 12 deletions

View 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

View 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);

View 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:

View 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);

View 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));
}