summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorbe_ <be.0@gmx.com>2017-04-11 12:05:23 -0500
committerbe_ <be.0@gmx.com>2017-04-11 12:05:23 -0500
commit9ee2d1c610618387569f298e4893352469af167d (patch)
tree4d67d62e536b4653c411fc1ca5e31efb5ecc2e51 /src/control
parent318fead37a303d3e473c22264a6c5ec03cbc8853 (diff)
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
Diffstat (limited to 'src/control')
-rw-r--r--src/control/controlbehavior.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/control/controlbehavior.cpp b/src/control/controlbehavior.cpp
index a435bf7d97..e00fb5216f 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));