\hypertarget{a00512_source}{}\doxysection{AAX\+\_\+\+CPiece\+Wise\+Linear\+Taper\+Delegate.\+h}
\label{a00512_source}\index{AAX\_CPieceWiseLinearTaperDelegate.h@{AAX\_CPieceWiseLinearTaperDelegate.h}}
\mbox{\hyperlink{a00512}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ Copyright\ 2014-\/2017,\ 2019,\ 2023-\/2024\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ This\ file\ is\ part\ of\ the\ Avid\ AAX\ SDK.}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ The\ AAX\ SDK\ is\ subject\ to\ commercial\ or\ open-\/source\ licensing.}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ By\ using\ the\ AAX\ SDK,\ you\ agree\ to\ the\ terms\ of\ both\ the\ Avid\ AAX\ SDK\ License}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ \ Agreement\ and\ Avid\ Privacy\ Policy.}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ AAX\ SDK\ License:\ https://developer.avid.com/aax}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ \ Privacy\ Policy:\ https://www.avid.com/legal/privacy-\/policy-\/statement}}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *\ \ Or:\ You\ may\ also\ use\ this\ code\ under\ the\ terms\ of\ the\ GPL\ v3\ (see}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ \ www.gnu.org/licenses).}}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ \ THE\ AAX\ SDK\ IS\ PROVIDED\ "{}AS\ IS"{}\ WITHOUT\ ANY\ WARRANTY,\ AND\ ALL\ WARRANTIES,\ WHETHER}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *\ \ EXPRESSED\ OR\ IMPLIED,\ INCLUDING\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ PURPOSE,\ ARE}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ \ DISCLAIMED.}}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00024\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00025\ }
\DoxyCodeLine{00032\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#ifndef\ AAX\_CPIECEWISELINEARTAPERDELEGATE\_H}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\#define\ AAX\_CPIECEWISELINEARTAPERDELEGATE\_H}}
\DoxyCodeLine{00037\ }
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00509}{AAX\_ITaperDelegate.h}}"{}}}
\DoxyCodeLine{00039\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00542}{AAX.h}}"{}}\ \ \ \textcolor{comment}{//for\ types}}
\DoxyCodeLine{00040\ }
\DoxyCodeLine{00041\ \textcolor{preprocessor}{\#include\ <cmath>}\ \ \ \ \textcolor{comment}{//for\ floor()}}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00067\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision=100>}
\DoxyCodeLine{00068\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02338}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00069\ \{}
\DoxyCodeLine{00070\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00079\ \ \ \ \ \mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}*\ normalizedValues,\ \textcolor{keyword}{const}\ T*\ realValues,\ int32\_t\ numValues);}
\DoxyCodeLine{00080\ \ \ \ \ }
\DoxyCodeLine{00081\ \ \ \ \ \mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate}}\&\ other);\ \ \ \ \textcolor{comment}{//Explicit\ copy\ constructor\ because\ there\ are\ internal\ arrays.}}
\DoxyCodeLine{00082\ \ \ \ \ \mbox{\hyperlink{a01922_a509915ce4f38ad211185baac8f37e13b}{\string~AAX\_CPieceWiseLinearTaperDelegate}}();}
\DoxyCodeLine{00083\ \ \ \ \ }
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{comment}{//Virtual\ AAX\_ITaperDelegate\ Overrides}}
\DoxyCodeLine{00085\ \ \ \ \ \mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>}}*\ \mbox{\hyperlink{a01922_ab8f9b4076d5d26f2fa8ce2ac34406241}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00086\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01922_a3e136c26307ec35f70a38fb15b0480ba}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00087\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01922_a260b67b9ff2b06265c705c126d045507}{GetMaximumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00088\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01922_ac9d5c430c625bb3e9720d009a1b9d779}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00089\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01922_aa95b3b0312bb861f20aa91888ba051bf}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00090\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01922_a5882df4a8f80ca2a88b512e87e7b36bc}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00091\ \ \ \ \ }
\DoxyCodeLine{00092\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00093\ \ \ \ \ T\ \ \ \mbox{\hyperlink{a01922_a6ec8cca43a67762239bb3bc123f4a7f5}{Round}}(\textcolor{keywordtype}{double}\ iValue)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00094\ \ \ \ \ }
\DoxyCodeLine{00095\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00096\ \ \ \ \ \textcolor{keywordtype}{double}*\ \ \ \ \ mNormalizedValues;}
\DoxyCodeLine{00097\ \ \ \ \ T*\ \ \ \ \ \ \ \ \ \ mRealValues;}
\DoxyCodeLine{00098\ \ \ \ \ int32\_t\ \ \ \ \ mNumValues;}
\DoxyCodeLine{00099\ \ \ \ \ T\ \ \ \ \ \ \ \ \ \ \ mMinValue;\ \ \ \ \ \ \textcolor{comment}{//Really\ just\ an\ optimization}}
\DoxyCodeLine{00100\ \ \ \ \ T\ \ \ \ \ \ \ \ \ \ \ mMaxValue;\ \ \ \ \ \ \textcolor{comment}{//Really\ just\ an\ optimization}}
\DoxyCodeLine{00101\ \};}
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00104\ T\ \ \ \mbox{\hyperlink{a01922_a6ec8cca43a67762239bb3bc123f4a7f5}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::Round}}(\textcolor{keywordtype}{double}\ iValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00105\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00106\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision\ >\ 0)}
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(floor(iValue\ *\ RealPrecision\ +\ 0.5)\ /\ RealPrecision);}
\DoxyCodeLine{00108\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00109\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(iValue);}
\DoxyCodeLine{00110\ \}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00112\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00113\ \mbox{\hyperlink{a01922_a265a1e6a8f81a1ad8e1aad7ebfceb480}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}*\ normalizedValues,\ \textcolor{keyword}{const}\ T*\ realValues,\ int32\_t\ numValues)\ \ :\ \ \mbox{\hyperlink{a02338}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00114\ \ \ \ \ mNormalizedValues(0),}
\DoxyCodeLine{00115\ \ \ \ \ mRealValues(0),}
\DoxyCodeLine{00116\ \ \ \ \ mNumValues(0),}
\DoxyCodeLine{00117\ \ \ \ \ mMinValue(0),}
\DoxyCodeLine{00118\ \ \ \ \ mMaxValue(0)}
\DoxyCodeLine{00119\ \{}
\DoxyCodeLine{00120\ \ \ \ \ mNormalizedValues\ =\ \textcolor{keyword}{new}\ \textcolor{keywordtype}{double}[numValues];}
\DoxyCodeLine{00121\ \ \ \ \ mRealValues\ =\ \textcolor{keyword}{new}\ T[numValues];}
\DoxyCodeLine{00122\ \ \ \ \ mNumValues\ =\ numValues;}
\DoxyCodeLine{00123\ }
\DoxyCodeLine{00124\ \ \ \ \ \textcolor{keywordflow}{if}\ (numValues\ >\ 0)}
\DoxyCodeLine{00125\ \ \ \ \ \{}
\DoxyCodeLine{00126\ \ \ \ \ \ \ \ \ mMaxValue\ =\ realValues[0];}
\DoxyCodeLine{00127\ \ \ \ \ \ \ \ \ mMinValue\ =\ realValues[0];}
\DoxyCodeLine{00128\ \ \ \ \ \}}
\DoxyCodeLine{00129\ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=0;\ i<\ numValues;\ i++)}
\DoxyCodeLine{00130\ \ \ \ \ \{}
\DoxyCodeLine{00131\ \ \ \ \ \ \ \ \ mNormalizedValues[i]\ =\ normalizedValues[i];}
\DoxyCodeLine{00132\ \ \ \ \ \ \ \ \ mRealValues[i]\ =\ realValues[i];}
\DoxyCodeLine{00133\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ >\ mMaxValue)}
\DoxyCodeLine{00134\ \ \ \ \ \ \ \ \ \ \ \ \ mMaxValue\ =\ mRealValues[i];}
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ <\ mMinValue)}
\DoxyCodeLine{00136\ \ \ \ \ \ \ \ \ \ \ \ \ mMinValue\ =\ mRealValues[i];}
\DoxyCodeLine{00137\ \ \ \ \ \}}
\DoxyCodeLine{00138\ \}}
\DoxyCodeLine{00139\ }
\DoxyCodeLine{00140\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00141\ \mbox{\hyperlink{a01922_a265a1e6a8f81a1ad8e1aad7ebfceb480}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate}}\&\ other)\ \ :\ \ \mbox{\hyperlink{a02338}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00142\ \ \ \ \ mNormalizedValues(0),}
\DoxyCodeLine{00143\ \ \ \ \ mRealValues(0),}
\DoxyCodeLine{00144\ \ \ \ \ mNumValues(0),}
\DoxyCodeLine{00145\ \ \ \ \ mMinValue(0),}
\DoxyCodeLine{00146\ \ \ \ \ mMaxValue(0)}
\DoxyCodeLine{00147\ \{}
\DoxyCodeLine{00148\ \ \ \ \ mNormalizedValues\ =\ \textcolor{keyword}{new}\ \textcolor{keywordtype}{double}[other.mNumValues];}
\DoxyCodeLine{00149\ \ \ \ \ mRealValues\ =\ \textcolor{keyword}{new}\ T[other.mNumValues];}
\DoxyCodeLine{00150\ \ \ \ \ mNumValues\ =\ other.mNumValues;}
\DoxyCodeLine{00151\ \ \ \ \ mMaxValue\ =\ other.mMaxValue;}
\DoxyCodeLine{00152\ \ \ \ \ mMinValue\ =\ other.mMinValue;}
\DoxyCodeLine{00153\ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=0;\ i<\ mNumValues;\ i++)}
\DoxyCodeLine{00154\ \ \ \ \ \{}
\DoxyCodeLine{00155\ \ \ \ \ \ \ \ \ mNormalizedValues[i]\ =\ other.mNormalizedValues[i];}
\DoxyCodeLine{00156\ \ \ \ \ \ \ \ \ mRealValues[i]\ =\ other.mRealValues[i];}
\DoxyCodeLine{00157\ \ \ \ \ \}\ \ \ }
\DoxyCodeLine{00158\ \}}
\DoxyCodeLine{00159\ }
\DoxyCodeLine{00160\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00161\ \mbox{\hyperlink{a01922_a509915ce4f38ad211185baac8f37e13b}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::\string~AAX\_CPieceWiseLinearTaperDelegate}}()\ }
\DoxyCodeLine{00162\ \{}
\DoxyCodeLine{00163\ \ \ \ \ mNumValues\ =\ 0;}
\DoxyCodeLine{00164\ \ \ \ \ \textcolor{keyword}{delete}\ []\ mNormalizedValues;\ }
\DoxyCodeLine{00165\ \ \ \ \ \textcolor{keyword}{delete}\ []\ mRealValues;}
\DoxyCodeLine{00166\ \}}
\DoxyCodeLine{00167\ }
\DoxyCodeLine{00168\ }
\DoxyCodeLine{00169\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00170\ \mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>}}*\ \ \ \ \ \mbox{\hyperlink{a01922_ab8f9b4076d5d26f2fa8ce2ac34406241}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00171\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00172\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01922}{AAX\_CPieceWiseLinearTaperDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00173\ \}}
\DoxyCodeLine{00174\ }
\DoxyCodeLine{00175\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00176\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01922_ac9d5c430c625bb3e9720d009a1b9d779}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00177\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00178\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00179\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00180\ \ \ \ \ }
\DoxyCodeLine{00181\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision)}
\DoxyCodeLine{00182\ \ \ \ \ \ \ \ \ value\ =\ Round(value);\ \ \ \ \ \ \ \textcolor{comment}{//reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00183\ \ \ \ \ }
\DoxyCodeLine{00184\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00185\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00186\ \ \ \ \ }
\DoxyCodeLine{00187\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00189\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00191\ \ \ \ \ }
\DoxyCodeLine{00192\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00193\ \}}
\DoxyCodeLine{00194\ }
\DoxyCodeLine{00195\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00196\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01922_aa95b3b0312bb861f20aa91888ba051bf}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00197\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00198\ }
\DoxyCodeLine{00199\ \ \ \ \ \textcolor{comment}{//\ Clip\ to\ normalized\ range.}}
\DoxyCodeLine{00200\ \ \ \ \ \textcolor{keywordflow}{if}\ (normalizedValue\ >\ 1.0)}
\DoxyCodeLine{00201\ \ \ \ \ \ \ \ \ normalizedValue\ =\ 1.0;}
\DoxyCodeLine{00202\ \ \ \ \ \textcolor{keywordflow}{if}\ (normalizedValue\ <\ 0.0)}
\DoxyCodeLine{00203\ \ \ \ \ \ \ \ \ normalizedValue\ =\ 0.0;}
\DoxyCodeLine{00204\ \ \ \ \ }
\DoxyCodeLine{00205\ \ \ \ \ \textcolor{comment}{//\ This\ is\ basically\ linear\ interpolation\ so\ let's\ first\ find\ the\ bounding\ normalized\ points\ from\ our\ specified\ array.}}
\DoxyCodeLine{00206\ \ \ \ \ int32\_t\ mLowerIndex\ =\ 0;}
\DoxyCodeLine{00207\ \ \ \ \ int32\_t\ mUpperIndex\ =\ 0;}
\DoxyCodeLine{00208\ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=1;i<mNumValues;i++)}
\DoxyCodeLine{00209\ \ \ \ \ \{}
\DoxyCodeLine{00210\ \ \ \ \ \ \ \ \ mUpperIndex++;}
\DoxyCodeLine{00211\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mNormalizedValues[i]\ >=\ normalizedValue)}
\DoxyCodeLine{00212\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00213\ \ \ \ \ \ \ \ \ mLowerIndex++;}
\DoxyCodeLine{00214\ \ \ \ \ \}}
\DoxyCodeLine{00215\ \ \ \ \ }
\DoxyCodeLine{00216\ \ \ \ \ \textcolor{comment}{//\ Do\ the\ interpolation.}}
\DoxyCodeLine{00217\ \ \ \ \ \textcolor{keywordtype}{double}\ delta\ =\ normalizedValue\ -\/\ mNormalizedValues[mLowerIndex];}
\DoxyCodeLine{00218\ \ \ \ \ \textcolor{keywordtype}{double}\ slope\ =\ double(mRealValues[mUpperIndex]\ -\/\ mRealValues[mLowerIndex])\ /\ (mNormalizedValues[mUpperIndex]\ -\/\ mNormalizedValues[mLowerIndex]);}
\DoxyCodeLine{00219\ \ \ \ \ \textcolor{keywordtype}{double}\ interpolatedValue\ =\ mRealValues[mLowerIndex]\ +\ (delta\ *\ slope);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00220\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(\textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(interpolatedValue));}
\DoxyCodeLine{00221\ \}}
\DoxyCodeLine{00222\ }
\DoxyCodeLine{00223\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00224\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01922_a5882df4a8f80ca2a88b512e87e7b36bc}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00225\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00226\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00227\ \ \ \ \ }
\DoxyCodeLine{00228\ \ \ \ \ \textcolor{comment}{//\ This\ is\ basically\ linear\ interpolation\ so\ let's\ first\ find\ the\ bounding\ normalized\ points\ from\ our\ specified\ array.}}
\DoxyCodeLine{00229\ \ \ \ \ int32\_t\ mLowerIndex\ =\ 0;}
\DoxyCodeLine{00230\ \ \ \ \ int32\_t\ mUpperIndex\ =\ 0;}
\DoxyCodeLine{00231\ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[0]\ <\ mRealValues[mNumValues-\/1])}
\DoxyCodeLine{00232\ \ \ \ \ \{}
\DoxyCodeLine{00233\ \ \ \ \ \ \ \ \ \textcolor{comment}{//Increasing\ real\ values\ (positive\ slope)}}
\DoxyCodeLine{00234\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=1;i<mNumValues;i++)}
\DoxyCodeLine{00235\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00236\ \ \ \ \ \ \ \ \ \ \ \ \ mUpperIndex++;}
\DoxyCodeLine{00237\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ >=\ realValue)}
\DoxyCodeLine{00238\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00239\ \ \ \ \ \ \ \ \ \ \ \ \ mLowerIndex++;}
\DoxyCodeLine{00240\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00241\ \ \ \ \ \}}
\DoxyCodeLine{00242\ \ \ \ \ \textcolor{keywordflow}{else}\ }
\DoxyCodeLine{00243\ \ \ \ \ \{}
\DoxyCodeLine{00244\ \ \ \ \ \ \ \ \ \textcolor{comment}{//Decreasing\ real\ values\ (negative\ slope)}}
\DoxyCodeLine{00245\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=1;i<mNumValues;i++)}
\DoxyCodeLine{00246\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00247\ \ \ \ \ \ \ \ \ \ \ \ \ mUpperIndex++;}
\DoxyCodeLine{00248\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ <=\ realValue)}
\DoxyCodeLine{00249\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00250\ \ \ \ \ \ \ \ \ \ \ \ \ mLowerIndex++;}
\DoxyCodeLine{00251\ \ \ \ \ \ \ \ \ \}\ \ \ \ \ \ \ }
\DoxyCodeLine{00252\ \ \ \ \ \}}
\DoxyCodeLine{00253\ \ \ \ \ }
\DoxyCodeLine{00254\ \ \ \ \ \textcolor{comment}{//\ Do\ the\ interpolation.}}
\DoxyCodeLine{00255\ \ \ \ \ \textcolor{keywordtype}{double}\ delta\ =\ realValue\ -\/\ mRealValues[mLowerIndex];}
\DoxyCodeLine{00256\ \ \ \ \ \textcolor{keywordtype}{double}\ slope\ =\ (mRealValues[mUpperIndex]\ ==\ mRealValues[mLowerIndex])\ ?\ 0.5\ :\ \textcolor{keywordtype}{double}(mNormalizedValues[mUpperIndex]\ -\/\ mNormalizedValues[mLowerIndex])\ /\ (mRealValues[mUpperIndex]\ -\/\ mRealValues[mLowerIndex]);}
\DoxyCodeLine{00257\ \ \ \ \ \textcolor{keywordtype}{double}\ interpolatedValue\ =\ mNormalizedValues[mLowerIndex]\ +\ (delta\ *\ slope);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00258\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(interpolatedValue);}
\DoxyCodeLine{00259\ \}}
\DoxyCodeLine{00260\ }
\DoxyCodeLine{00261\ }
\DoxyCodeLine{00262\ }
\DoxyCodeLine{00263\ }
\DoxyCodeLine{00264\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CPIECEWISELINEARTAPERDELEGATE\_H}}

\end{DoxyCode}
