diff options
author | Sander Vocke <sandervocke@gmail.com> | 2024-07-25 20:16:34 +0200 |
---|---|---|
committer | Sander Vocke <sandervocke@gmail.com> | 2024-07-25 20:16:34 +0200 |
commit | 9c2425dadf78bc547d7b21f47779238caa98823f (patch) | |
tree | 59266b6b3074d86db2b5881917339c891a28f971 /src/curvemap.cc | |
parent | 65fe72afbfbbde1432765100acb2a875c8eadbd4 (diff) |
Fix initialization issue in curve mapcurve_map_midimap
Diffstat (limited to 'src/curvemap.cc')
-rw-r--r-- | src/curvemap.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/curvemap.cc b/src/curvemap.cc index 858c7b8..569ccd9 100644 --- a/src/curvemap.cc +++ b/src/curvemap.cc @@ -131,31 +131,34 @@ void CurveMap::reset() void CurveMap::setFixed0(CurveValuePair new_value) { - if (fixed[0] != new_value) + auto prev = fixed[0]; + fixed[0].in = clamp(new_value.in, eps, fixed[1].in - eps); + fixed[0].out = clamp(new_value.out, eps, fixed[1].out - eps); + if (fixed[0] != prev) { spline_needs_update = true; - fixed[0].in = clamp(new_value.in, eps, fixed[1].in - eps); - fixed[0].out = clamp(new_value.out, eps, fixed[1].out - eps); } } void CurveMap::setFixed1(CurveValuePair new_value) { - if (fixed[1] != new_value) + auto prev = fixed[1]; + fixed[1].in = clamp(new_value.in, fixed[0].in + eps, fixed[2].in - eps); + fixed[1].out = clamp(new_value.out, fixed[0].out + eps, fixed[2].out - eps); + if (fixed[1] != prev) { spline_needs_update = true; - fixed[1].in = clamp(new_value.in, fixed[0].in + eps, fixed[2].in - eps); - fixed[1].out = clamp(new_value.out, fixed[0].out + eps, fixed[2].out - eps); } } void CurveMap::setFixed2(CurveValuePair new_value) { - if (fixed[2] != new_value) + auto prev = fixed[2]; + fixed[2].in = clamp(new_value.in, fixed[1].in + eps, 1 - eps); + fixed[2].out = clamp(new_value.out, fixed[1].out + eps, 1 - eps); + if (fixed[2] != prev) { spline_needs_update = true; - fixed[2].in = clamp(new_value.in, fixed[1].in + eps, 1 - eps); - fixed[2].out = clamp(new_value.out, fixed[1].out + eps, 1 - eps); } } |