21#ifndef AAX_CLOGTAPERDELEGATE_H
22#define AAX_CLOGTAPERDELEGATE_H
57template <
typename T,
int32_t RealPrecision=1000>
79 T
Round(
double iValue)
const;
86template <
typename T,
int32_t RealPrecision>
89 double precision = RealPrecision;
91 return static_cast<T
>(floor(iValue * precision + 0.5) / precision);
92 return static_cast<T
>(iValue);
95template <
typename T,
int32_t RealPrecision>
103template <
typename T,
int32_t RealPrecision>
109template <
typename T,
int32_t RealPrecision>
112 if (mMinValue == mMaxValue)
116 value = Round(value);
118 const T& highValue = mMaxValue > mMinValue ? mMaxValue : mMinValue;
119 const T& lowValue = mMaxValue > mMinValue ? mMinValue : mMaxValue;
121 if (value > highValue)
123 if (value < lowValue)
129template <
typename T,
int32_t RealPrecision>
135 double doubleRealValue = exp(normalizedValue * (maxLog - minLog) + minLog);
136 T realValue = (T) doubleRealValue;
138 return ConstrainRealValue(realValue);
141template <
typename T,
int32_t RealPrecision>
147 realValue = ConstrainRealValue(realValue);
148 double normalizedValue = (maxLog == minLog) ? 0.5 : (
AAX::SafeLog(
double(realValue)) - minLog) / (maxLog - minLog);
149 return normalizedValue;
Defines the taper conversion behavior for a parameter.
Various utility definitions for AAX.
#define AAX_OVERRIDE
override keyword macro
Definition: AAX.h:151
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:50
A logarithmic taper conforming to AAX_ITaperDelegate.
Definition: AAX_CLogTaperDelegate.h:59
T NormalizedToReal(double normalizedValue) const AAX_OVERRIDE
Converts a normalized value to a real value.
Definition: AAX_CLogTaperDelegate.h:130
T GetMinimumValue() const AAX_OVERRIDE
Returns the taper's minimum real value.
Definition: AAX_CLogTaperDelegate.h:72
AAX_CLogTaperDelegate(T minValue=0, T maxValue=1)
Constructs a Log Taper with specified minimum and maximum values.
Definition: AAX_CLogTaperDelegate.h:96
T GetMaximumValue() const AAX_OVERRIDE
Returns the taper's maximum real value.
Definition: AAX_CLogTaperDelegate.h:73
T Round(double iValue) const
Definition: AAX_CLogTaperDelegate.h:87
double RealToNormalized(T realValue) const AAX_OVERRIDE
Normalizes a real parameter value.
Definition: AAX_CLogTaperDelegate.h:142
T ConstrainRealValue(T value) const AAX_OVERRIDE
Applies a contraint to the value and returns the constrained value.
Definition: AAX_CLogTaperDelegate.h:110
AAX_CLogTaperDelegate< T, RealPrecision > * Clone() const AAX_OVERRIDE
Constructs and returns a copy of the taper delegate.
Definition: AAX_CLogTaperDelegate.h:104
Definition: AAX_ITaperDelegate.h:86