Skip to content

Commit

Permalink
do not clamp out-of-bounds ControlPotmeter parameters when allowed
Browse files Browse the repository at this point in the history
getting the normalized value should reflect the actual value of the
ControlPotmeter if out-of-bounds values are allowed
  • Loading branch information
Be-ing committed Apr 11, 2017
1 parent 318fead commit 9ee2d1c
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/control/controlbehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 9ee2d1c

Please sign in to comment.