summaryrefslogtreecommitdiff
path: root/libs/ardour/vst_plugin.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2017-07-06 16:15:34 +0200
committerRobin Gareus <robin@gareus.org>2017-07-06 16:32:27 +0200
commit73ad5c97f2f988868750936ef466564611488494 (patch)
tree32fc797cab252716298a496d3cdddfbe350ce845 /libs/ardour/vst_plugin.cc
parentf66b863a2db106146579592245678f2aa9da800f (diff)
Consistently set parameter steps.
And it's actually mostly moot. interface_to_internal maps any range to 0..1. The GUI could just hardcode min/max 0, 1 and steps 1/30, 1/300. Except for controls that have explicit range-steps & ctrl surfaces.
Diffstat (limited to 'libs/ardour/vst_plugin.cc')
-rw-r--r--libs/ardour/vst_plugin.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/libs/ardour/vst_plugin.cc b/libs/ardour/vst_plugin.cc
index 787210af6a..b61ee4186c 100644
--- a/libs/ardour/vst_plugin.cc
+++ b/libs/ardour/vst_plugin.cc
@@ -342,27 +342,22 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
desc.upper = 1.0;
}
- if (prop.flags & kVstParameterUsesIntStep) {
+ const float range = desc.upper - desc.lower;
+ if (prop.flags & kVstParameterUsesIntStep && prop.stepInteger < range) {
desc.step = prop.stepInteger;
desc.smallstep = prop.stepInteger;
desc.largestep = prop.stepInteger;
desc.integer_step = true;
-
- } else if (prop.flags & kVstParameterUsesFloatStep) {
-
+ desc.rangesteps = 1 + ceilf (range / desc.step);
+ } else if (prop.flags & kVstParameterUsesFloatStep && prop.stepFloat < range) {
desc.step = prop.stepFloat;
desc.smallstep = prop.smallStepFloat;
desc.largestep = prop.largeStepFloat;
- // desc.rangesteps = (desc.upper - desc.lower) / prop.smallStepFloat; // XXX
-
+ desc.rangesteps = 1 + ceilf (range / desc.step);
} else {
-
- float range = desc.upper - desc.lower;
-
- desc.step = range / 100.0f;
- desc.smallstep = desc.step / 2.0f;
- desc.largestep = desc.step * 10.0f;
+ desc.smallstep = desc.step = range / 300.0f;
+ desc.largestep = range / 30.0f;
}
if (strlen(prop.label) == 0) {
@@ -385,11 +380,16 @@ VSTPlugin::get_parameter_descriptor (uint32_t which, ParameterDescriptor& desc)
desc.label = Glib::locale_to_utf8 (label);
desc.lower = 0.0f;
desc.upper = 1.0f;
- desc.step = 0.01f;
- desc.smallstep = 0.005f;
- desc.largestep = 0.1f;
+ desc.smallstep = desc.step = 1.f / 300.f;
+ desc.largestep = 1.f / 30.f;
}
+ /* TODO we should really call
+ * desc.update_steps ()
+ * instead of manually assigning steps. Yet, VST prop is (again)
+ * the odd one out compared to other plugin formats.
+ */
+
if (_parameter_defaults.find (which) == _parameter_defaults.end ()) {
_parameter_defaults[which] = get_parameter (which);
} else {