mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-12 01:26:31 +01:00
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
This commit is contained in:
parent
ef184b54f2
commit
fa828e0385
1 changed files with 7 additions and 0 deletions
|
|
@ -1198,6 +1198,7 @@ AutomationLine::view_to_model_coord_y (double& y) const
|
||||||
/* TODO: This should be more generic (use ParameterDescriptor)
|
/* TODO: This should be more generic (use ParameterDescriptor)
|
||||||
* or better yet: Controllable -> set_interface();
|
* or better yet: Controllable -> set_interface();
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( alist->parameter().type() == GainAutomation
|
if ( alist->parameter().type() == GainAutomation
|
||||||
|| alist->parameter().type() == EnvelopeAutomation
|
|| alist->parameter().type() == EnvelopeAutomation
|
||||||
|| (_desc.logarithmic && _desc.lower == 0. && _desc.upper > _desc.lower)) {
|
|| (_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 ||
|
} else if (alist->parameter().type() == PanAzimuthAutomation ||
|
||||||
alist->parameter().type() == PanElevationAutomation) {
|
alist->parameter().type() == PanElevationAutomation) {
|
||||||
y = 1.0 - y;
|
y = 1.0 - y;
|
||||||
|
y = max ((double) _desc.lower, y);
|
||||||
|
y = min ((double) _desc.upper, y);
|
||||||
} else if (alist->parameter().type() == PanWidthAutomation) {
|
} else if (alist->parameter().type() == PanWidthAutomation) {
|
||||||
y = 2.0 * y - 1.0;
|
y = 2.0 * y - 1.0;
|
||||||
|
y = max ((double) _desc.lower, y);
|
||||||
|
y = min ((double) _desc.upper, y);
|
||||||
} else {
|
} else {
|
||||||
y = y * (double)(alist->get_max_y() - alist->get_min_y()) + alist->get_min_y();
|
y = y * (double)(alist->get_max_y() - alist->get_min_y()) + alist->get_min_y();
|
||||||
if (_desc.integer_step) {
|
if (_desc.integer_step) {
|
||||||
|
|
@ -1223,6 +1228,8 @@ AutomationLine::view_to_model_coord_y (double& y) const
|
||||||
} else if (_desc.toggled) {
|
} else if (_desc.toggled) {
|
||||||
y = (y > 0.5) ? 1.0 : 0.0;
|
y = (y > 0.5) ? 1.0 : 0.0;
|
||||||
}
|
}
|
||||||
|
y = max ((double) _desc.lower, y);
|
||||||
|
y = min ((double) _desc.upper, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue