Clamp the bend range to have a symmetry with respect to 0

This commit is contained in:
Paul Ferrand 2019-12-13 13:56:19 +01:00
parent 55e938642d
commit 5d94521af9

View file

@ -88,14 +88,15 @@ inline constexpr float normalizePercents(T percentValue)
} }
/** /**
* @brief Normalize bends between -1 and 1 * @brief Normalize bends between -1 and 1. We clamp to 8191 instead of 8192 in the low end
* to have something symmetric with respect to 0.
* *
* @param bendValue * @param bendValue
* @return constexpr float * @return constexpr float
*/ */
inline constexpr float normalizeBend(int bendValue) inline constexpr float normalizeBend(int bendValue)
{ {
return std::min(std::max(static_cast<float>(bendValue), -8192.0f), 8192.0f) / 8192.0f; return std::min(std::max(static_cast<float>(bendValue), -8191.0f), 8191.0f) / 8191.0f;
} }
/** /**