24 #ifndef AAX_CLOGTAPERDELEGATE_H
25 #define AAX_CLOGTAPERDELEGATE_H
60 template <
typename T,
int32_t RealPrecision=1000>
82 T
Round(
double iValue)
const;
89 template <
typename T,
int32_t RealPrecision>
92 double precision = RealPrecision;
94 return static_cast<T
>(floor(iValue * precision + 0.5) / precision);
95 return static_cast<T
>(iValue);
98 template <
typename T,
int32_t RealPrecision>
106 template <
typename T,
int32_t RealPrecision>
112 template <
typename T,
int32_t RealPrecision>
115 if (mMinValue == mMaxValue)
119 value = Round(value);
121 const T& highValue = mMaxValue > mMinValue ? mMaxValue : mMinValue;
122 const T& lowValue = mMaxValue > mMinValue ? mMinValue : mMaxValue;
124 if (value > highValue)
126 if (value < lowValue)
132 template <
typename T,
int32_t RealPrecision>
138 double doubleRealValue = exp(normalizedValue * (maxLog - minLog) + minLog);
139 T realValue = (T) doubleRealValue;
141 return ConstrainRealValue(realValue);
144 template <
typename T,
int32_t RealPrecision>
150 realValue = ConstrainRealValue(realValue);
151 double normalizedValue = (maxLog == minLog) ? 0.5 : (
AAX::SafeLog(
double(realValue)) - minLog) / (maxLog - minLog);
152 return normalizedValue;
Various utility definitions for AAX.
#define AAX_OVERRIDE
override keyword macro
Definition: AAX.h:141
Defines the taper conversion behavior for a parameter.
Various utility definitions for AAX Native.
double SafeLog(double aValue)
Double-precision safe log function. Returns zero for input values that are <= 0.0.
Definition: AAX_UtilsNative.h:53
A logarithmic taper conforming to AAX_ITaperDelegate.
Definition: AAX_CLogTaperDelegate.h:62
T NormalizedToReal(double normalizedValue) const AAX_OVERRIDE
Converts a normalized value to a real value.
Definition: AAX_CLogTaperDelegate.h:133
T GetMinimumValue() const AAX_OVERRIDE
Returns the taper's minimum real value.
Definition: AAX_CLogTaperDelegate.h:75
AAX_CLogTaperDelegate(T minValue=0, T maxValue=1)
Constructs a Log Taper with specified minimum and maximum values.
Definition: AAX_CLogTaperDelegate.h:99
T GetMaximumValue() const AAX_OVERRIDE
Returns the taper's maximum real value.
Definition: AAX_CLogTaperDelegate.h:76
T Round(double iValue) const
Definition: AAX_CLogTaperDelegate.h:90
double RealToNormalized(T realValue) const AAX_OVERRIDE
Normalizes a real parameter value.
Definition: AAX_CLogTaperDelegate.h:145
T ConstrainRealValue(T value) const AAX_OVERRIDE
Applies a contraint to the value and returns the constrained value.
Definition: AAX_CLogTaperDelegate.h:113
AAX_CLogTaperDelegate< T, RealPrecision > * Clone() const AAX_OVERRIDE
Constructs and returns a copy of the taper delegate.
Definition: AAX_CLogTaperDelegate.h:107
Classes for conversion to and from normalized parameter values.
Definition: AAX_ITaperDelegate.h:89