AAX SDK  2.4.1
Avid Audio Extensions Development Kit
List of all members | Public Member Functions | Protected Member Functions
AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision > Class Template Reference

#include <AAX_CPieceWiseLinearTaperDelegate.h>

Inheritance diagram for AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >:
[legend]
Collaboration diagram for AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >:
[legend]

Description

template<typename T, int32_t RealPrecision = 100>
class AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >

A piece-wise linear taper conforming to AAX_ITaperDelegate.

This taper spaces a parameter's real values in a piecewise linear fashion.

RealPrecision
In addition to its type templatization, this taper includes a precision template parameter. RealPrecision is a multiplier that works in conjunction with the round() function to limit the precision of the real values provided by this taper. For example, if RealPrecision is 1000, it will round to the closest 0.001 when doing any sort of value conversion. If RealPrecision is 1, it will round to the nearest integer. If RealPrecision is 1000000, it will round to the nearest 0.000001. This is particularly useful for preventing things like 1.9999999 truncating down to 1 instead of rounding up to 2.

To accomplish this behavior, the taper multiplies its unrounded parameter values by RealPrecision, rounds the result to the nearest valid value, then divides RealPrecision back out.

Rounding will be disabled if RealPrecision is set to a value less than 1

Public Member Functions

 AAX_CPieceWiseLinearTaperDelegate (const double *normalizedValues, const T *realValues, int32_t numValues)
 Constructs a Piece-wise Linear Taper with paired normalized and real values. More...
 
 AAX_CPieceWiseLinearTaperDelegate (const AAX_CPieceWiseLinearTaperDelegate &other)
 
 ~AAX_CPieceWiseLinearTaperDelegate ()
 
AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision > * Clone () const AAX_OVERRIDE
 Constructs and returns a copy of the taper delegate. More...
 
GetMinimumValue () const AAX_OVERRIDE
 Returns the taper's minimum real value. More...
 
GetMaximumValue () const AAX_OVERRIDE
 Returns the taper's maximum real value. More...
 
ConstrainRealValue (T value) const AAX_OVERRIDE
 Applies a contraint to the value and returns the constrained value. More...
 
NormalizedToReal (double normalizedValue) const AAX_OVERRIDE
 Converts a normalized value to a real value. More...
 
double RealToNormalized (T realValue) const AAX_OVERRIDE
 Normalizes a real parameter value. More...
 
- Public Member Functions inherited from AAX_ITaperDelegateBase
virtual ~AAX_ITaperDelegateBase ()
 Virtual destructor. More...
 

Protected Member Functions

Round (double iValue) const
 

Constructor & Destructor Documentation

◆ AAX_CPieceWiseLinearTaperDelegate() [1/2]

template<typename T , int32_t RealPrecision>
AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::AAX_CPieceWiseLinearTaperDelegate ( const double *  normalizedValues,
const T *  realValues,
int32_t  numValues 
)

Constructs a Piece-wise Linear Taper with paired normalized and real values.

Note
The parameter's default value should lie within the min to max range.
Parameters
[in]normalizedValuesis an array of the normalized values in sorted order. (make sure to include the full normalized range, 0.0-1.0 inclusive)
[in]realValuesis an array of the corresponding real values to the normalized values passed in.
[in]numValuesis the number of values that have been passed in (i.e. the element length of the other input arrays)

◆ AAX_CPieceWiseLinearTaperDelegate() [2/2]

template<typename T , int32_t RealPrecision>
AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::AAX_CPieceWiseLinearTaperDelegate ( const AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision > &  other)

◆ ~AAX_CPieceWiseLinearTaperDelegate()

template<typename T , int32_t RealPrecision>
AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::~AAX_CPieceWiseLinearTaperDelegate

Member Function Documentation

◆ Clone()

template<typename T , int32_t RealPrecision>
AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision > * AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::Clone ( ) const
virtual

Constructs and returns a copy of the taper delegate.

In general, this method's implementation can use a simple copy constructor:

template <typename T>
AAX_CSubclassTaperDelegate<T>* AAX_CSubclassTaperDelegate<T>::Clone() const
{
return new AAX_CSubclassTaperDelegate(*this);
}

Implements AAX_ITaperDelegate< T >.

◆ GetMinimumValue()

template<typename T , int32_t RealPrecision = 100>
T AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::GetMinimumValue ( ) const
inlinevirtual

Returns the taper's minimum real value.

Implements AAX_ITaperDelegate< T >.

◆ GetMaximumValue()

template<typename T , int32_t RealPrecision = 100>
T AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::GetMaximumValue ( ) const
inlinevirtual

Returns the taper's maximum real value.

Implements AAX_ITaperDelegate< T >.

◆ ConstrainRealValue()

template<typename T , int32_t RealPrecision>
T AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::ConstrainRealValue ( value) const
virtual

Applies a contraint to the value and returns the constrained value.

This method is useful if the taper requires a contraint beyond simple minimum and maximum real value limits.

Note
This is the function that should actually enforces the constraints in NormalizeToReal() and RealToNormalized().
Parameters
[in]valueThe unconstrained value

Implements AAX_ITaperDelegate< T >.

◆ NormalizedToReal()

template<typename T , int32_t RealPrecision>
T AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::NormalizedToReal ( double  normalizedValue) const
virtual

Converts a normalized value to a real value.

This is where the actual taper algorithm is implemented.

This function should perform the exact inverse of RealToNormalized(), to within the roundoff precision of the individual taper implementation.

Parameters
[in]normalizedValueThe normalized value that will be converted

Implements AAX_ITaperDelegate< T >.

◆ RealToNormalized()

template<typename T , int32_t RealPrecision>
double AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::RealToNormalized ( realValue) const
virtual

Normalizes a real parameter value.

This is where the actual taper algorithm is implemented.

This function should perform the exact inverse of NormalizedToReal(), to within the roundoff precision of the individual taper implementation.

Parameters
[in]realValueThe real parameter value that will be normalized

Implements AAX_ITaperDelegate< T >.

◆ Round()

template<typename T , int32_t RealPrecision>
T AAX_CPieceWiseLinearTaperDelegate< T, RealPrecision >::Round ( double  iValue) const
protected

The documentation for this class was generated from the following file: