diff options
author | David Robillard <d@drobilla.net> | 2007-06-30 18:41:50 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-06-30 18:41:50 +0000 |
commit | bbf41757133a29df0d37905f2fdce091878d2ffd (patch) | |
tree | 2506ed83985d406019236c68704df0b9542dbe3a /libs/ardour/plugin.cc | |
parent | 685fa95e729e5d510b28b4c715da062e9db580d9 (diff) |
Another not-quite-there-but-better commit.
Brought plugin automation into the fold of new automation system.
Fixed plugin automation, broke panner automation :] (pending Panner work).
Made AutomationController better at automatically following it's controller value (mimic what gain meter does).
Fixed some visible automation track bugs (but still broken WRT serialization).
git-svn-id: svn://localhost/ardour2/trunk@2092 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/plugin.cc')
-rw-r--r-- | libs/ardour/plugin.cc | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/libs/ardour/plugin.cc b/libs/ardour/plugin.cc index 1b93ecf82b..bc5688c318 100644 --- a/libs/ardour/plugin.cc +++ b/libs/ardour/plugin.cc @@ -58,105 +58,10 @@ Plugin::Plugin (const Plugin& other) { } -void -Plugin::setup_controls () -{ - uint32_t port_cnt = parameter_count(); - - /* set up a vector of null pointers for the controls. - we'll fill this in on an as-needed basis. - */ - - for (uint32_t i = 0; i < port_cnt; ++i) { - controls.push_back (0); - } -} - Plugin::~Plugin () { - for (vector<PortControllable*>::iterator i = controls.begin(); i != controls.end(); ++i) { - if (*i) { - delete *i; - } - } -} - -Controllable * -Plugin::get_nth_control (uint32_t n) -{ - if (n >= parameter_count()) { - return 0; - } - - if (controls[n] == 0) { - - Plugin::ParameterDescriptor desc; - - get_parameter_descriptor (n, desc); - - controls[n] = new PortControllable (describe_parameter (ParamID(PluginAutomation, n)), *this, n, - desc.lower, desc.upper, desc.toggled, desc.logarithmic); - } - - return controls[n]; } -Plugin::PortControllable::PortControllable (string name, Plugin& p, uint32_t port_id, - float low, float up, bool t, bool loga) - : Controllable (name), plugin (p), absolute_port (port_id) -{ - toggled = t; - logarithmic = loga; - lower = low; - upper = up; - range = upper - lower; -} - -void -Plugin::PortControllable::set_value (float value) -{ - if (toggled) { - if (value > 0.5) { - value = 1.0; - } else { - value = 0.0; - } - } else { - - if (!logarithmic) { - value = lower + (range * value); - } else { - float _lower = 0.0f; - if (lower > 0.0f) { - _lower = log(lower); - } - - value = exp(_lower + log(range) * value); - } - } - - plugin.set_parameter (absolute_port, value); -} - -float -Plugin::PortControllable::get_value (void) const -{ - float val = plugin.get_parameter (absolute_port); - - if (toggled) { - - return val; - - } else { - - if (logarithmic) { - val = log(val); - } - - return ((val - lower) / range); - } -} - vector<string> Plugin::get_presets() { |