From 9ee2d1c610618387569f298e4893352469af167d Mon Sep 17 00:00:00 2001 From: be_ Date: Tue, 11 Apr 2017 12:05:23 -0500 Subject: [PATCH] do not clamp out-of-bounds ControlPotmeter parameters when allowed getting the normalized value should reflect the actual value of the ControlPotmeter if out-of-bounds values are allowed --- src/control/controlbehavior.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/control/controlbehavior.cpp b/src/control/controlbehavior.cpp index a435bf7d973..e00fb5216f1 100644 --- a/src/control/controlbehavior.cpp +++ b/src/control/controlbehavior.cpp @@ -56,10 +56,12 @@ double ControlPotmeterBehavior::valueToParameter(double dValue) { if (m_dValueRange == 0.0) { return 0; } - if (dValue > m_dMaxValue) { - dValue = m_dMaxValue; - } else if (dValue < m_dMinValue) { - dValue = m_dMinValue; + if (!m_bAllowOutOfBounds) { + if (dValue > m_dMaxValue) { + dValue = m_dMaxValue; + } else if (dValue < m_dMinValue) { + dValue = m_dMinValue; + } } return (dValue - m_dMinValue) / m_dValueRange; } @@ -116,10 +118,12 @@ double ControlLogPotmeterBehavior::valueToParameter(double dValue) { if (m_dValueRange == 0.0) { return 0; } - if (dValue > m_dMaxValue) { - dValue = m_dMaxValue; - } else if (dValue < m_dMinValue) { - dValue = m_dMinValue; + if (!m_bAllowOutOfBounds) { + if (dValue > m_dMaxValue) { + dValue = m_dMaxValue; + } else if (dValue < m_dMinValue) { + dValue = m_dMinValue; + } } double linPrameter = (dValue - m_dMinValue) / m_dValueRange; double dbParamter = ratio2db(linPrameter + m_minOffset * (1 - linPrameter));