Use a constexpr minmax in SfzHelpers
This commit is contained in:
parent
3d7ff1bca9
commit
9a49348274
1 changed files with 3 additions and 2 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
|
#include "MathHelpers.h"
|
||||||
|
|
||||||
namespace sfz
|
namespace sfz
|
||||||
{
|
{
|
||||||
|
|
@ -85,7 +86,7 @@ template<class T>
|
||||||
constexpr float normalizeCC(T ccValue)
|
constexpr float normalizeCC(T ccValue)
|
||||||
{
|
{
|
||||||
static_assert(std::is_integral<T>::value, "Requires an integral T");
|
static_assert(std::is_integral<T>::value, "Requires an integral T");
|
||||||
return static_cast<float>(std::min(std::max(ccValue, static_cast<T>(0)), static_cast<T>(127))) / 127.0f;
|
return static_cast<float>(min(max(ccValue, static_cast<T>(0)), static_cast<T>(127))) / 127.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -124,7 +125,7 @@ constexpr float normalizePercents(T percentValue)
|
||||||
*/
|
*/
|
||||||
constexpr float normalizeBend(float bendValue)
|
constexpr float normalizeBend(float bendValue)
|
||||||
{
|
{
|
||||||
return std::min(std::max(bendValue, -8191.0f), 8191.0f) / 8191.0f;
|
return min(max(bendValue, -8191.0f), 8191.0f) / 8191.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue