Added a helper to normalize bend ranges

This commit is contained in:
Paul Ferrand 2019-12-09 23:24:25 +01:00
parent a1282ff193
commit db3b85e941

View file

@ -87,6 +87,17 @@ inline constexpr float normalizePercents(T percentValue)
return std::min(std::max(static_cast<float>(percentValue), 0.0f), 100.0f) / 100.0f;
}
/**
* @brief Normalize bends between -1 and 1
*
* @param bendValue
* @return constexpr float
*/
inline constexpr float normalizeBend(int bendValue)
{
return std::min(std::max(static_cast<float>(bendValue), -8192.0f), 8192.0f) / 8192.0f;
}
/**
* @brief Normalize a possibly negative percentage between -1 and 1
*