34#ifndef AAX_CLOGTAPERDELEGATE_H
35#define AAX_CLOGTAPERDELEGATE_H
70template <
typename T,
int32_t RealPrecision=1000>
92 T
Round(
double iValue)
const;
99template <
typename T,
int32_t RealPrecision>
102 double precision = RealPrecision;
104 return static_cast<T
>(floor(iValue * precision + 0.5) / precision);
105 return static_cast<T
>(iValue);
108template <
typename T,
int32_t RealPrecision>
116template <
typename T,
int32_t RealPrecision>
122template <
typename T,
int32_t RealPrecision>
125 if (mMinValue == mMaxValue)
129 value = Round(value);
131 const T& highValue = mMaxValue > mMinValue ? mMaxValue : mMinValue;
132 const T& lowValue = mMaxValue > mMinValue ? mMinValue : mMaxValue;
134 if (value > highValue)
136 if (value < lowValue)
142template <
typename T,
int32_t RealPrecision>
148 double doubleRealValue = exp(normalizedValue * (maxLog - minLog) + minLog);
149 T realValue = (T) doubleRealValue;
151 return ConstrainRealValue(realValue);
154template <
typename T,
int32_t RealPrecision>
160 realValue = ConstrainRealValue(realValue);
161 double normalizedValue = (maxLog == minLog) ? 0.5 : (
AAX::SafeLog(
double(realValue)) - minLog) / (maxLog - minLog);
162 return normalizedValue;
Defines the taper conversion behavior for a parameter.
Various utility definitions for AAX.
#define AAX_OVERRIDE
override keyword macro
Definition: AAX.h:164
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:63
A logarithmic taper conforming to AAX_ITaperDelegate.
Definition: AAX_CLogTaperDelegate.h:72
T NormalizedToReal(double normalizedValue) const AAX_OVERRIDE
Converts a normalized value to a real value.
Definition: AAX_CLogTaperDelegate.h:143
T GetMinimumValue() const AAX_OVERRIDE
Returns the taper's minimum real value.
Definition: AAX_CLogTaperDelegate.h:85
AAX_CLogTaperDelegate(T minValue=0, T maxValue=1)
Constructs a Log Taper with specified minimum and maximum values.
Definition: AAX_CLogTaperDelegate.h:109
T GetMaximumValue() const AAX_OVERRIDE
Returns the taper's maximum real value.
Definition: AAX_CLogTaperDelegate.h:86
T Round(double iValue) const
Definition: AAX_CLogTaperDelegate.h:100
double RealToNormalized(T realValue) const AAX_OVERRIDE
Normalizes a real parameter value.
Definition: AAX_CLogTaperDelegate.h:155
T ConstrainRealValue(T value) const AAX_OVERRIDE
Applies a contraint to the value and returns the constrained value.
Definition: AAX_CLogTaperDelegate.h:123
AAX_CLogTaperDelegate< T, RealPrecision > * Clone() const AAX_OVERRIDE
Constructs and returns a copy of the taper delegate.
Definition: AAX_CLogTaperDelegate.h:117
Definition: AAX_ITaperDelegate.h:99