\hypertarget{a00503_source}{}\doxysection{AAX\+\_\+\+CPiece\+Wise\+Linear\+Taper\+Delegate.\+h}
\label{a00503_source}\index{AAX\_CPieceWiseLinearTaperDelegate.h@{AAX\_CPieceWiseLinearTaperDelegate.h}}
\mbox{\hyperlink{a00503}{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\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ CONFIDENTIAL:\ this\ document\ contains\ confidential\ information\ of\ Avid.\ Do}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ not\ disclose\ to\ any\ third\ party.\ Use\ of\ the\ information\ contained\ in\ this}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ \ document\ is\ subject\ to\ an\ Avid\ SDK\ license.}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00012\ }
\DoxyCodeLine{00019\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ }
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#ifndef\ AAX\_CPIECEWISELINEARTAPERDELEGATE\_H}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ AAX\_CPIECEWISELINEARTAPERDELEGATE\_H}}
\DoxyCodeLine{00024\ }
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00500}{AAX\_ITaperDelegate.h}}"{}}}
\DoxyCodeLine{00026\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00533}{AAX.h}}"{}}\ \ \ \textcolor{comment}{//for\ types}}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#include\ <cmath>}\ \ \ \ \textcolor{comment}{//for\ floor()}}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00054\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision=100>}
\DoxyCodeLine{00055\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00056\ \{}
\DoxyCodeLine{00057\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00066\ \ \ \ \ \mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}*\ normalizedValues,\ \textcolor{keyword}{const}\ T*\ realValues,\ int32\_t\ numValues);}
\DoxyCodeLine{00067\ \ \ \ \ }
\DoxyCodeLine{00068\ \ \ \ \ \mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate}}\&\ other);\ \ \ \ \textcolor{comment}{//Explicit\ copy\ constructor\ because\ there\ are\ internal\ arrays.}}
\DoxyCodeLine{00069\ \ \ \ \ \mbox{\hyperlink{a01909_a509915ce4f38ad211185baac8f37e13b}{\string~AAX\_CPieceWiseLinearTaperDelegate}}();}
\DoxyCodeLine{00070\ \ \ \ \ }
\DoxyCodeLine{00071\ \ \ \ \ \textcolor{comment}{//Virtual\ AAX\_ITaperDelegate\ Overrides}}
\DoxyCodeLine{00072\ \ \ \ \ \mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>}}*\ \mbox{\hyperlink{a01909_ab8f9b4076d5d26f2fa8ce2ac34406241}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00073\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01909_a3e136c26307ec35f70a38fb15b0480ba}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00074\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01909_a260b67b9ff2b06265c705c126d045507}{GetMaximumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00075\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01909_ac9d5c430c625bb3e9720d009a1b9d779}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00076\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01909_aa95b3b0312bb861f20aa91888ba051bf}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00077\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01909_a5882df4a8f80ca2a88b512e87e7b36bc}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00078\ \ \ \ \ }
\DoxyCodeLine{00079\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00080\ \ \ \ \ T\ \ \ \mbox{\hyperlink{a01909_a6ec8cca43a67762239bb3bc123f4a7f5}{Round}}(\textcolor{keywordtype}{double}\ iValue)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00081\ \ \ \ \ }
\DoxyCodeLine{00082\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{keywordtype}{double}*\ \ \ \ \ mNormalizedValues;}
\DoxyCodeLine{00084\ \ \ \ \ T*\ \ \ \ \ \ \ \ \ \ mRealValues;}
\DoxyCodeLine{00085\ \ \ \ \ int32\_t\ \ \ \ \ mNumValues;}
\DoxyCodeLine{00086\ \ \ \ \ T\ \ \ \ \ \ \ \ \ \ \ mMinValue;\ \ \ \ \ \ \textcolor{comment}{//Really\ just\ an\ optimization}}
\DoxyCodeLine{00087\ \ \ \ \ T\ \ \ \ \ \ \ \ \ \ \ mMaxValue;\ \ \ \ \ \ \textcolor{comment}{//Really\ just\ an\ optimization}}
\DoxyCodeLine{00088\ \};}
\DoxyCodeLine{00089\ }
\DoxyCodeLine{00090\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00091\ T\ \ \ \mbox{\hyperlink{a01909_a6ec8cca43a67762239bb3bc123f4a7f5}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::Round}}(\textcolor{keywordtype}{double}\ iValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00092\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00093\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision\ >\ 0)}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(floor(iValue\ *\ RealPrecision\ +\ 0.5)\ /\ RealPrecision);}
\DoxyCodeLine{00095\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(iValue);}
\DoxyCodeLine{00097\ \}}
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00099\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00100\ \mbox{\hyperlink{a01909_a265a1e6a8f81a1ad8e1aad7ebfceb480}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \textcolor{keywordtype}{double}*\ normalizedValues,\ \textcolor{keyword}{const}\ T*\ realValues,\ int32\_t\ numValues)\ \ :\ \ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00101\ \ \ \ \ mNormalizedValues(0),}
\DoxyCodeLine{00102\ \ \ \ \ mRealValues(0),}
\DoxyCodeLine{00103\ \ \ \ \ mNumValues(0),}
\DoxyCodeLine{00104\ \ \ \ \ mMinValue(0),}
\DoxyCodeLine{00105\ \ \ \ \ mMaxValue(0)}
\DoxyCodeLine{00106\ \{}
\DoxyCodeLine{00107\ \ \ \ \ mNormalizedValues\ =\ \textcolor{keyword}{new}\ \textcolor{keywordtype}{double}[numValues];}
\DoxyCodeLine{00108\ \ \ \ \ mRealValues\ =\ \textcolor{keyword}{new}\ T[numValues];}
\DoxyCodeLine{00109\ \ \ \ \ mNumValues\ =\ numValues;}
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{keywordflow}{if}\ (numValues\ >\ 0)}
\DoxyCodeLine{00112\ \ \ \ \ \{}
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ mMaxValue\ =\ realValues[0];}
\DoxyCodeLine{00114\ \ \ \ \ \ \ \ \ mMinValue\ =\ realValues[0];}
\DoxyCodeLine{00115\ \ \ \ \ \}}
\DoxyCodeLine{00116\ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=0;\ i<\ numValues;\ i++)}
\DoxyCodeLine{00117\ \ \ \ \ \{}
\DoxyCodeLine{00118\ \ \ \ \ \ \ \ \ mNormalizedValues[i]\ =\ normalizedValues[i];}
\DoxyCodeLine{00119\ \ \ \ \ \ \ \ \ mRealValues[i]\ =\ realValues[i];}
\DoxyCodeLine{00120\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ >\ mMaxValue)}
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ \ \ \ \ mMaxValue\ =\ mRealValues[i];}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ <\ mMinValue)}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \ \ \ \ mMinValue\ =\ mRealValues[i];}
\DoxyCodeLine{00124\ \ \ \ \ \}}
\DoxyCodeLine{00125\ \}}
\DoxyCodeLine{00126\ }
\DoxyCodeLine{00127\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00128\ \mbox{\hyperlink{a01909_a265a1e6a8f81a1ad8e1aad7ebfceb480}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::AAX\_CPieceWiseLinearTaperDelegate}}(\textcolor{keyword}{const}\ \mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate}}\&\ other)\ \ :\ \ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00129\ \ \ \ \ mNormalizedValues(0),}
\DoxyCodeLine{00130\ \ \ \ \ mRealValues(0),}
\DoxyCodeLine{00131\ \ \ \ \ mNumValues(0),}
\DoxyCodeLine{00132\ \ \ \ \ mMinValue(0),}
\DoxyCodeLine{00133\ \ \ \ \ mMaxValue(0)}
\DoxyCodeLine{00134\ \{}
\DoxyCodeLine{00135\ \ \ \ \ mNormalizedValues\ =\ \textcolor{keyword}{new}\ \textcolor{keywordtype}{double}[other.mNumValues];}
\DoxyCodeLine{00136\ \ \ \ \ mRealValues\ =\ \textcolor{keyword}{new}\ T[other.mNumValues];}
\DoxyCodeLine{00137\ \ \ \ \ mNumValues\ =\ other.mNumValues;}
\DoxyCodeLine{00138\ \ \ \ \ mMaxValue\ =\ other.mMaxValue;}
\DoxyCodeLine{00139\ \ \ \ \ mMinValue\ =\ other.mMinValue;}
\DoxyCodeLine{00140\ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=0;\ i<\ mNumValues;\ i++)}
\DoxyCodeLine{00141\ \ \ \ \ \{}
\DoxyCodeLine{00142\ \ \ \ \ \ \ \ \ mNormalizedValues[i]\ =\ other.mNormalizedValues[i];}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ mRealValues[i]\ =\ other.mRealValues[i];}
\DoxyCodeLine{00144\ \ \ \ \ \}\ \ \ }
\DoxyCodeLine{00145\ \}}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00148\ \mbox{\hyperlink{a01909_a509915ce4f38ad211185baac8f37e13b}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::\string~AAX\_CPieceWiseLinearTaperDelegate}}()\ }
\DoxyCodeLine{00149\ \{}
\DoxyCodeLine{00150\ \ \ \ \ mNumValues\ =\ 0;}
\DoxyCodeLine{00151\ \ \ \ \ \textcolor{keyword}{delete}\ []\ mNormalizedValues;\ }
\DoxyCodeLine{00152\ \ \ \ \ \textcolor{keyword}{delete}\ []\ mRealValues;}
\DoxyCodeLine{00153\ \}}
\DoxyCodeLine{00154\ }
\DoxyCodeLine{00155\ }
\DoxyCodeLine{00156\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00157\ \mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>}}*\ \ \ \ \ \mbox{\hyperlink{a01909_ab8f9b4076d5d26f2fa8ce2ac34406241}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00158\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00159\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01909}{AAX\_CPieceWiseLinearTaperDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00160\ \}}
\DoxyCodeLine{00161\ }
\DoxyCodeLine{00162\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00163\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01909_ac9d5c430c625bb3e9720d009a1b9d779}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00164\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00165\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00166\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00167\ \ \ \ \ }
\DoxyCodeLine{00168\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision)}
\DoxyCodeLine{00169\ \ \ \ \ \ \ \ \ value\ =\ Round(value);\ \ \ \ \ \ \ \textcolor{comment}{//reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00170\ \ \ \ \ }
\DoxyCodeLine{00171\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00172\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00173\ \ \ \ \ }
\DoxyCodeLine{00174\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00175\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00176\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00177\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00178\ \ \ \ \ }
\DoxyCodeLine{00179\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00180\ \}}
\DoxyCodeLine{00181\ }
\DoxyCodeLine{00182\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00183\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01909_aa95b3b0312bb861f20aa91888ba051bf}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00184\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00185\ }
\DoxyCodeLine{00186\ \ \ \ \ \textcolor{comment}{//\ Clip\ to\ normalized\ range.}}
\DoxyCodeLine{00187\ \ \ \ \ \textcolor{keywordflow}{if}\ (normalizedValue\ >\ 1.0)}
\DoxyCodeLine{00188\ \ \ \ \ \ \ \ \ normalizedValue\ =\ 1.0;}
\DoxyCodeLine{00189\ \ \ \ \ \textcolor{keywordflow}{if}\ (normalizedValue\ <\ 0.0)}
\DoxyCodeLine{00190\ \ \ \ \ \ \ \ \ normalizedValue\ =\ 0.0;}
\DoxyCodeLine{00191\ \ \ \ \ }
\DoxyCodeLine{00192\ \ \ \ \ \textcolor{comment}{//\ This\ is\ basically\ linear\ interpolation\ so\ let's\ first\ find\ the\ bounding\ normalized\ points\ from\ our\ specified\ array.}}
\DoxyCodeLine{00193\ \ \ \ \ int32\_t\ mLowerIndex\ =\ 0;}
\DoxyCodeLine{00194\ \ \ \ \ int32\_t\ mUpperIndex\ =\ 0;}
\DoxyCodeLine{00195\ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=1;i<mNumValues;i++)}
\DoxyCodeLine{00196\ \ \ \ \ \{}
\DoxyCodeLine{00197\ \ \ \ \ \ \ \ \ mUpperIndex++;}
\DoxyCodeLine{00198\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mNormalizedValues[i]\ >=\ normalizedValue)}
\DoxyCodeLine{00199\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ mLowerIndex++;}
\DoxyCodeLine{00201\ \ \ \ \ \}}
\DoxyCodeLine{00202\ \ \ \ \ }
\DoxyCodeLine{00203\ \ \ \ \ \textcolor{comment}{//\ Do\ the\ interpolation.}}
\DoxyCodeLine{00204\ \ \ \ \ \textcolor{keywordtype}{double}\ delta\ =\ normalizedValue\ -\/\ mNormalizedValues[mLowerIndex];}
\DoxyCodeLine{00205\ \ \ \ \ \textcolor{keywordtype}{double}\ slope\ =\ double(mRealValues[mUpperIndex]\ -\/\ mRealValues[mLowerIndex])\ /\ (mNormalizedValues[mUpperIndex]\ -\/\ mNormalizedValues[mLowerIndex]);}
\DoxyCodeLine{00206\ \ \ \ \ \textcolor{keywordtype}{double}\ interpolatedValue\ =\ mRealValues[mLowerIndex]\ +\ (delta\ *\ slope);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00207\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(\textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(interpolatedValue));}
\DoxyCodeLine{00208\ \}}
\DoxyCodeLine{00209\ }
\DoxyCodeLine{00210\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00211\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01909_a5882df4a8f80ca2a88b512e87e7b36bc}{AAX\_CPieceWiseLinearTaperDelegate<T,\ RealPrecision>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00212\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00213\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00214\ \ \ \ \ }
\DoxyCodeLine{00215\ \ \ \ \ \textcolor{comment}{//\ This\ is\ basically\ linear\ interpolation\ so\ let's\ first\ find\ the\ bounding\ normalized\ points\ from\ our\ specified\ array.}}
\DoxyCodeLine{00216\ \ \ \ \ int32\_t\ mLowerIndex\ =\ 0;}
\DoxyCodeLine{00217\ \ \ \ \ int32\_t\ mUpperIndex\ =\ 0;}
\DoxyCodeLine{00218\ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[0]\ <\ mRealValues[mNumValues-\/1])}
\DoxyCodeLine{00219\ \ \ \ \ \{}
\DoxyCodeLine{00220\ \ \ \ \ \ \ \ \ \textcolor{comment}{//Increasing\ real\ values\ (positive\ slope)}}
\DoxyCodeLine{00221\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=1;i<mNumValues;i++)}
\DoxyCodeLine{00222\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00223\ \ \ \ \ \ \ \ \ \ \ \ \ mUpperIndex++;}
\DoxyCodeLine{00224\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ >=\ realValue)}
\DoxyCodeLine{00225\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ \ \ \ \ mLowerIndex++;}
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ \}}
\DoxyCodeLine{00228\ \ \ \ \ \}}
\DoxyCodeLine{00229\ \ \ \ \ \textcolor{keywordflow}{else}\ }
\DoxyCodeLine{00230\ \ \ \ \ \{}
\DoxyCodeLine{00231\ \ \ \ \ \ \ \ \ \textcolor{comment}{//Decreasing\ real\ values\ (negative\ slope)}}
\DoxyCodeLine{00232\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{for}\ (int32\_t\ i=1;i<mNumValues;i++)}
\DoxyCodeLine{00233\ \ \ \ \ \ \ \ \ \{}
\DoxyCodeLine{00234\ \ \ \ \ \ \ \ \ \ \ \ \ mUpperIndex++;}
\DoxyCodeLine{00235\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (mRealValues[i]\ <=\ realValue)}
\DoxyCodeLine{00236\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00237\ \ \ \ \ \ \ \ \ \ \ \ \ mLowerIndex++;}
\DoxyCodeLine{00238\ \ \ \ \ \ \ \ \ \}\ \ \ \ \ \ \ }
\DoxyCodeLine{00239\ \ \ \ \ \}}
\DoxyCodeLine{00240\ \ \ \ \ }
\DoxyCodeLine{00241\ \ \ \ \ \textcolor{comment}{//\ Do\ the\ interpolation.}}
\DoxyCodeLine{00242\ \ \ \ \ \textcolor{keywordtype}{double}\ delta\ =\ realValue\ -\/\ mRealValues[mLowerIndex];}
\DoxyCodeLine{00243\ \ \ \ \ \textcolor{keywordtype}{double}\ slope\ =\ (mRealValues[mUpperIndex]\ ==\ mRealValues[mLowerIndex])\ ?\ 0.5\ :\ \textcolor{keywordtype}{double}(mNormalizedValues[mUpperIndex]\ -\/\ mNormalizedValues[mLowerIndex])\ /\ (mRealValues[mUpperIndex]\ -\/\ mRealValues[mLowerIndex]);}
\DoxyCodeLine{00244\ \ \ \ \ \textcolor{keywordtype}{double}\ interpolatedValue\ =\ mNormalizedValues[mLowerIndex]\ +\ (delta\ *\ slope);\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00245\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(interpolatedValue);}
\DoxyCodeLine{00246\ \}}
\DoxyCodeLine{00247\ }
\DoxyCodeLine{00248\ }
\DoxyCodeLine{00249\ }
\DoxyCodeLine{00250\ }
\DoxyCodeLine{00251\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CPIECEWISELINEARTAPERDELEGATE\_H}}

\end{DoxyCode}
