Skip to content

Commit

Permalink
Merge pull request #1237 from Be-ing/getparameter_out_of_bounds_fix
Browse files Browse the repository at this point in the history
do not clamp out-of-bounds ControlPotmeter parameters when they are allowed
  • Loading branch information
daschuer authored Apr 17, 2017
2 parents 7b73abf + 9ee2d1c commit 244eaeb
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 244eaeb

Please sign in to comment.