| AAX SDK 2.8.0 Avid Audio Extensions Development Kit

- Welcome
- Manual
- Classes
- Files
- Lists
- Support

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
List of all members | Public Member Functions | Protected Member Functions
AAX_CRangeTaperDelegate< T, RealPrecision > Class Template Reference

`#include <AAX_CRangeTaperDelegate.h>`

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

## Description

template<typename T, int32_t RealPrecision = 1000>
class AAX_CRangeTaperDelegate< T, RealPrecision >

A piecewise-linear taper conforming to AAX_ITaperDelegate.

This taper spaces a parameter's real values between its minimum and maximum using a series of linear regions to create the full mapping between the parameter's real and normalized values.

Here is an example of how this taper can be used:

float rangePoints[] = { 0.0, 1.0, 100.0, 1000.0, 2000.0 };
double rangeSteps[] = { 0.1, 1.0, 10.0, 25.0 }; // number of steps per range: 10, 99, 90, 40
const long cNumRanges = sizeof(rangeSteps)/sizeof(rangeSteps[0]);
long numSteps = 0;
for (int i = 0; i < cNumRanges; i++)
{
numSteps += (rangePoints[i+1] - rangePoints[i]) / rangeSteps[i];
}
AAX_CRangeTaperDelegate<float> nonLinearTaper(rangePoints, rangeSteps, cNumRanges);
float controlValue = 1.5;
double normalized = nonLinearTaper.RealToNormalized(controlValue);
float real = nonLinearTaper.NormalizedToReal(normalized);
AAX_CRangeTaperDelegate
A piecewise-linear taper conforming to AAX_ITaperDelegate.
Definition: AAX_CRangeTaperDelegate.h:94

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_CRangeTaperDelegate (T *range, double *rangesSteps, unsigned long numRanges, bool useSmartRounding=true)
| Constructs a Range Taper with specified minimum and maximum values.
| AAX_CRangeTaperDelegate (const AAX_CRangeTaperDelegate &rhs)
AAX_CRangeTaperDelegate & | operator= (AAX_CRangeTaperDelegate &rhs)
AAX_CRangeTaperDelegate< T, RealPrecision > * | Clone () const AAX_OVERRIDE
| Constructs and returns a copy of the taper delegate.
T | GetMinimumValue () const AAX_OVERRIDE
| Returns the taper's minimum real value.
T | GetMaximumValue () const AAX_OVERRIDE
| Returns the taper's maximum real value.
T | ConstrainRealValue (T value) const AAX_OVERRIDE
| Applies a contraint to the value and returns the constrained value.
T | NormalizedToReal (double normalizedValue) const AAX_OVERRIDE
| Converts a normalized value to a real value.
double | RealToNormalized (T realValue) const AAX_OVERRIDE
| Normalizes a real parameter value.
virtual AAX_ITaperDelegate * | Clone () const =0
| Constructs and returns a copy of the taper delegate.
virtual T | GetMaximumValue () const =0
| Returns the taper's maximum real value.
virtual T | GetMinimumValue () const =0
| Returns the taper's minimum real value.
virtual T | ConstrainRealValue (T value) const =0
| Applies a contraint to the value and returns the constrained value.
virtual T | NormalizedToReal (double normalizedValue) const =0
| Converts a normalized value to a real value.
virtual double | RealToNormalized (T realValue) const =0
| Normalizes a real parameter value.
Public Member Functions inherited from AAX_ITaperDelegateBase
virtual | ~AAX_ITaperDelegateBase ()
| Virtual destructor.

## Protected Member Functions
T | Round (double iValue) const
T | SmartRound (double value) const

## Constructor & Destructor Documentation

## ◆ AAX_CRangeTaperDelegate() [1/2]

template<typename T , int32_t RealPrecision>

AAX_CRangeTaperDelegate< T, RealPrecision >::AAX_CRangeTaperDelegate | ( | T * | range,
|  | double * | rangesSteps,
|  | unsigned long | numRanges,
|  | bool | useSmartRounding = `true`
| ) |  |

Constructs a Range Taper with specified minimum and maximum values.

Note
  The parameter's default value should lie within the min to max range.

Parameters

  [in] | range | An array of range endpoints along the taper's mapping range
  [in] | rangesSteps | Step values for each region in the taper's stepwise-linear map. No values in this array may be zero.
  [in] | numRanges | The total number of linear regions in the taper's map
  [in] | useSmartRounding |

Todo:
  Document useSmartRounding parameter

## ◆ AAX_CRangeTaperDelegate() [2/2]

template<typename T , int32_t RealPrecision>

AAX_CRangeTaperDelegate< T, RealPrecision >::AAX_CRangeTaperDelegate | ( | const AAX_CRangeTaperDelegate< T, RealPrecision > & | rhs | ) |

## Member Function Documentation

## ◆ operator=()

template<typename T , int32_t RealPrecision>

AAX_CRangeTaperDelegate< T, RealPrecision > & AAX_CRangeTaperDelegate< T, RealPrecision >::operator= | ( | AAX_CRangeTaperDelegate< T, RealPrecision > & | rhs | ) |

## ◆ Clone()

template<typename T , int32_t RealPrecision>

AAX_CRangeTaperDelegate< T, RealPrecision > * AAX_CRangeTaperDelegate< 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 = 1000>

T AAX_CRangeTaperDelegate< T, RealPrecision >::GetMinimumValue | ( |  | ) | const
| inline virtual

Returns the taper's minimum real value.

Implements AAX_ITaperDelegate< T >.

## ◆ GetMaximumValue()

template<typename T , int32_t RealPrecision = 1000>

T AAX_CRangeTaperDelegate< T, RealPrecision >::GetMaximumValue | ( |  | ) | const
| inline virtual

Returns the taper's maximum real value.

Implements AAX_ITaperDelegate< T >.

## ◆ ConstrainRealValue()

template<typename T , int32_t RealPrecision>

T AAX_CRangeTaperDelegate< T, RealPrecision >::ConstrainRealValue | ( | T | 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] | value | The unconstrained value

Implements AAX_ITaperDelegate< T >.

## ◆ NormalizedToReal()

template<typename T , int32_t RealPrecision>

T AAX_CRangeTaperDelegate< 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] | normalizedValue | The normalized value that will be converted

Implements AAX_ITaperDelegate< T >.

## ◆ RealToNormalized()

template<typename T , int32_t RealPrecision>

double AAX_CRangeTaperDelegate< T, RealPrecision >::RealToNormalized | ( | T | 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] | realValue | The real parameter value that will be normalized

Implements AAX_ITaperDelegate< T >.

## ◆ Round()

template<typename T , int32_t RealPrecision>

T AAX_CRangeTaperDelegate< T, RealPrecision >::Round | ( | double | iValue | ) | const
| protected

## ◆ SmartRound()

template<typename T , int32_t RealPrecision>

T AAX_CRangeTaperDelegate< T, RealPrecision >::SmartRound | ( | double | value | ) | const
| protected

Todo:
  Document

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

- AAX_CRangeTaperDelegate.h