diff options
author | David Robillard <d@drobilla.net> | 2014-11-01 23:29:10 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-11-02 02:10:24 -0500 |
commit | 8a128b33d38172ae525ac798c53bc105bc4e2c64 (patch) | |
tree | 226459f2fec72a9717d12f190d354f72175607dc /gtk2_ardour/automation_controller.cc | |
parent | 6dfb11c2d08201f1a27818955707590b762f5a40 (diff) |
Automation of LV2 plugin properties.
Work towards ParameterDescriptor being used more universally to describe control characteristics.
Diffstat (limited to 'gtk2_ardour/automation_controller.cc')
-rw-r--r-- | gtk2_ardour/automation_controller.cc | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/gtk2_ardour/automation_controller.cc b/gtk2_ardour/automation_controller.cc index 564387a55e..c4cc93386f 100644 --- a/gtk2_ardour/automation_controller.cc +++ b/gtk2_ardour/automation_controller.cc @@ -36,7 +36,9 @@ using namespace ARDOUR; using namespace Gtk; -AutomationController::AutomationController(boost::shared_ptr<Automatable> printer, boost::shared_ptr<AutomationControl> ac, Adjustment* adj) +AutomationController::AutomationController(boost::shared_ptr<Automatable> printer, + boost::shared_ptr<AutomationControl> ac, + Adjustment* adj) : BarController (*adj, ac) , _ignore_change(false) , _printer (printer) @@ -64,21 +66,27 @@ AutomationController::~AutomationController() } boost::shared_ptr<AutomationController> -AutomationController::create( - boost::shared_ptr<Automatable> printer, - const Evoral::Parameter& param, - boost::shared_ptr<AutomationControl> ac) +AutomationController::create(boost::shared_ptr<Automatable> printer, + const Evoral::Parameter& param, + const ParameterDescriptor& desc, + boost::shared_ptr<AutomationControl> ac) { - double const lo = ac->internal_to_interface(param.min()); - double const up = ac->internal_to_interface(param.max()); + const double lo = ac->internal_to_interface(desc.lower); + const double up = ac->internal_to_interface(desc.upper); + const double normal = ac->internal_to_interface(desc.normal); + double smallstep = desc.smallstep; + double largestep = desc.largestep; + if (smallstep == 0.0) { + smallstep = (up - lo) / 100; + } + if (largestep == 0.0) { + largestep = (up - lo) / 10; + } + smallstep = ac->internal_to_interface(smallstep); + largestep = ac->internal_to_interface(largestep); + Gtk::Adjustment* adjustment = manage ( - new Gtk::Adjustment ( - ac->internal_to_interface(param.normal()), - lo, up, - // TODO we should use explicit step-sizes if provided by Plugin::ParameterDescriptor - (up - lo) / 100, (up - lo) / 10 - ) - ); + new Gtk::Adjustment (normal, lo, up, smallstep, largestep)); assert (ac); assert(ac->parameter() == param); |