diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-01-09 12:41:49 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-01-09 12:41:49 +0000 |
commit | fa828e0385fbac4ed640c645ef8fe8dfaa6a810a (patch) | |
tree | 6a1a5cb7bf64f8709f2591ebed80e864d29c787e /gtk2_ardour/automation_line.cc | |
parent | ef184b54f2a94546abfd10395f959efaa6ddb135 (diff) |
clamp values appropriately in AutomationLine::view_to_model_y()
Before this, drags from one automation track to another could add illegal/stupid values to an automation line. Presumably there needs to be another bounds check in ControlList
Diffstat (limited to 'gtk2_ardour/automation_line.cc')
-rw-r--r-- | gtk2_ardour/automation_line.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc index a422bf9723..acc6cffd0e 100644 --- a/gtk2_ardour/automation_line.cc +++ b/gtk2_ardour/automation_line.cc @@ -1198,6 +1198,7 @@ AutomationLine::view_to_model_coord_y (double& y) const /* TODO: This should be more generic (use ParameterDescriptor) * or better yet: Controllable -> set_interface(); */ + if ( alist->parameter().type() == GainAutomation || alist->parameter().type() == EnvelopeAutomation || (_desc.logarithmic && _desc.lower == 0. && _desc.upper > _desc.lower)) { @@ -1214,8 +1215,12 @@ AutomationLine::view_to_model_coord_y (double& y) const } else if (alist->parameter().type() == PanAzimuthAutomation || alist->parameter().type() == PanElevationAutomation) { y = 1.0 - y; + y = max ((double) _desc.lower, y); + y = min ((double) _desc.upper, y); } else if (alist->parameter().type() == PanWidthAutomation) { y = 2.0 * y - 1.0; + y = max ((double) _desc.lower, y); + y = min ((double) _desc.upper, y); } else { y = y * (double)(alist->get_max_y() - alist->get_min_y()) + alist->get_min_y(); if (_desc.integer_step) { @@ -1223,6 +1228,8 @@ AutomationLine::view_to_model_coord_y (double& y) const } else if (_desc.toggled) { y = (y > 0.5) ? 1.0 : 0.0; } + y = max ((double) _desc.lower, y); + y = min ((double) _desc.upper, y); } } |