\hypertarget{a00653_source}{}\doxysection{AAX\+\_\+\+CRange\+Taper\+Delegate.\+h}
\label{a00653_source}\index{AAX\_CRangeTaperDelegate.h@{AAX\_CRangeTaperDelegate.h}}
\mbox{\hyperlink{a00653}{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\ 2013-\/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\_CRANGETAPERDELEGATE\_H}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ AAX\_CRANGETAPERDELEGATE\_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\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00079\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision=1000>}
\DoxyCodeLine{00080\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00081\ \{}
\DoxyCodeLine{00082\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00096\ \ \ \ \ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate}}(T*\ range,\ \textcolor{keywordtype}{double}*\ rangesSteps,\ \textcolor{keywordtype}{long}\ numRanges,\ \textcolor{keywordtype}{bool}\ useSmartRounding\ =\ \textcolor{keyword}{true});}
\DoxyCodeLine{00097\ \ \ \ \ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate}}(\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate}}\&\ rhs);}
\DoxyCodeLine{00098\ \ \ \ \ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate}}\&\ \mbox{\hyperlink{a01913_abb6a95a43a8614a1c83fc84208d2e8f1}{operator=}}(\ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate}}\&\ rhs\ );}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00101\ \ \ \ \ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>}}*\ \mbox{\hyperlink{a01913_a787f7649ff4b94af1642bfa0198007a2}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00102\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01913_a94f30f1ae6f4be57d2fe44928fb4a467}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00103\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01913_a37653711483325931180ed54234b63ec}{GetMaximumValue}}()\ \ \ \ const\ \ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00104\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01913_aecea5b86d9f5c6a5b1af87ba04d8473d}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00105\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01913_a50b58efa795c9973ab199d4f5bb31de4}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00106\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01913_a457a42ac3e78debf4c595ac1afeec7cf}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00108\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00109\ \ \ \ \ T\ \ \ \mbox{\hyperlink{a01913_a67b913916d7296ad69bf262363704e6f}{Round}}(\textcolor{keywordtype}{double}\ iValue)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00110\ \ \ \ \ T\ \ \ \mbox{\hyperlink{a01913_a4b0c76eb0cd262598dbe5118068fbefb}{SmartRound}}(\textcolor{keywordtype}{double}\ value)\ \textcolor{keyword}{const};\ \ \ \ \ \ \ }
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00112\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00113\ \ \ \ \ T\ \ \ \ \ \ \ mMinValue;}
\DoxyCodeLine{00114\ \ \ \ \ T\ \ \ \ \ \ \ mMaxValue;}
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordtype}{long}\ \ \ \ mNumRanges;}
\DoxyCodeLine{00116\ \ \ \ \ std::vector<T>\ mRanges;}
\DoxyCodeLine{00117\ \ \ \ \ std::vector<double>\ mRangesSteps;\ \ \ \ \ \ \ }
\DoxyCodeLine{00118\ \ \ \ \ std::vector<double>\ mRangesPercents;\ \ \ \ }
\DoxyCodeLine{00119\ \ \ \ \ std::vector<double>\ mRangesStepsCount;\ \ }
\DoxyCodeLine{00120\ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ mUseSmartRounding;}
\DoxyCodeLine{00121\ \};}
\DoxyCodeLine{00122\ }
\DoxyCodeLine{00123\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00124\ \mbox{\hyperlink{a01913_a06236d6426f76ff4f7a1d51e9dec5b8c}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::AAX\_CRangeTaperDelegate}}(T*\ ranges,\ \textcolor{keywordtype}{double}*\ rangesSteps,\ \textcolor{keywordtype}{long}\ numRanges,\ \textcolor{keywordtype}{bool}\ useSmartRounding)\ :}
\DoxyCodeLine{00125\ \ \ \ \ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00126\ \ \ \ \ mMinValue(*ranges),\ }
\DoxyCodeLine{00127\ \ \ \ \ mMaxValue(*(ranges\ +\ numRanges)),}
\DoxyCodeLine{00128\ \ \ \ \ mNumRanges(numRanges),}
\DoxyCodeLine{00129\ \ \ \ \ mRanges(\ ranges,\ ranges\ +\ numRanges\ +\ 1),}
\DoxyCodeLine{00130\ \ \ \ \ mRangesSteps(\ rangesSteps,\ rangesSteps\ +\ numRanges),}
\DoxyCodeLine{00131\ \ \ \ \ mUseSmartRounding(\ useSmartRounding\ )}
\DoxyCodeLine{00132\ \{}
\DoxyCodeLine{00133\ \ \ \ \ mRangesStepsCount.reserve(numRanges);}
\DoxyCodeLine{00134\ \ \ \ \ mRangesPercents.reserve(numRanges);}
\DoxyCodeLine{00135\ \ \ \ \ \textcolor{keywordtype}{int}\ i\ =\ 0;}
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keywordflow}{for}\ (;\ i\ <\ mNumRanges;\ i++)}
\DoxyCodeLine{00137\ \ \ \ \ \{}
\DoxyCodeLine{00138\ \ \ \ \ \ \ \ \ mRangesStepsCount.push\_back(\ (mRanges.at(i\ +\ 1)\ -\/\ mRanges.at(i))\ /\ mRangesSteps.at(i));}
\DoxyCodeLine{00139\ \ \ \ \ \}}
\DoxyCodeLine{00140\ \ \ \ \ \textcolor{keywordtype}{double}\ numSteps\ =\ 0;}
\DoxyCodeLine{00141\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ mNumRanges;\ i++)}
\DoxyCodeLine{00142\ \ \ \ \ \{}
\DoxyCodeLine{00143\ \ \ \ \ \ \ \ \ numSteps\ +=\ mRangesStepsCount.at(i);}
\DoxyCodeLine{00144\ \ \ \ \ \}}
\DoxyCodeLine{00145\ \ \ \ \ \textcolor{keywordflow}{for}\ (i\ =\ 0;\ i\ <\ mNumRanges;\ i++)}
\DoxyCodeLine{00146\ \ \ \ \ \{}
\DoxyCodeLine{00147\ \ \ \ \ \ \ \ \ mRangesPercents.push\_back(\ mRangesStepsCount.at(i)\ /\ numSteps\ );}
\DoxyCodeLine{00148\ \ \ \ \ \}}
\DoxyCodeLine{00149\ \}}
\DoxyCodeLine{00150\ }
\DoxyCodeLine{00151\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00152\ \mbox{\hyperlink{a01913_a06236d6426f76ff4f7a1d51e9dec5b8c}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::AAX\_CRangeTaperDelegate}}(\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>}}\&\ rhs)\ :}
\DoxyCodeLine{00153\ \ \ \ \ mMinValue(rhs.mMinValue),}
\DoxyCodeLine{00154\ \ \ \ \ mMaxValue(rhs.mMaxValue),}
\DoxyCodeLine{00155\ \ \ \ \ mNumRanges(rhs.mNumRanges),}
\DoxyCodeLine{00156\ \ \ \ \ mRanges(\ rhs.mRanges.begin(),\ rhs.mRanges.end()),}
\DoxyCodeLine{00157\ \ \ \ \ mRangesSteps(\ rhs.mRangesSteps.begin(),\ rhs.mRangesSteps.end()),}
\DoxyCodeLine{00158\ \ \ \ \ mRangesPercents(\ rhs.mRangesPercents.begin(),\ rhs.mRangesPercents.end()),}
\DoxyCodeLine{00159\ \ \ \ \ mRangesStepsCount(\ rhs.mRangesStepsCount.begin(),\ rhs.mRangesStepsCount.end()),}
\DoxyCodeLine{00160\ \ \ \ \ mUseSmartRounding(\ rhs.mUseSmartRounding\ )}
\DoxyCodeLine{00161\ \{}
\DoxyCodeLine{00162\ \}}
\DoxyCodeLine{00163\ }
\DoxyCodeLine{00164\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00165\ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>}}\&\ \mbox{\hyperlink{a01913_abb6a95a43a8614a1c83fc84208d2e8f1}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::operator=}}(\ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>}}\&\ rhs)}
\DoxyCodeLine{00166\ \{}
\DoxyCodeLine{00167\ \ \ \ \ \textcolor{keywordflow}{if}\ (\textcolor{keyword}{this}\ ==\ \&rhs)}
\DoxyCodeLine{00168\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00169\ }
\DoxyCodeLine{00170\ \ \ \ \ this-\/>mMinValue\ =\ rhs.mMinValue;}
\DoxyCodeLine{00171\ \ \ \ \ this-\/>mMaxValue\ =\ rhs.mMaxValue;}
\DoxyCodeLine{00172\ \ \ \ \ this-\/>mNumRanges\ =\ rhs.mNumRanges;}
\DoxyCodeLine{00173\ \ \ \ \ this-\/>mRanges.assign(\ rhs.mRanges.begin(),\ rhs.mRanges.end());}
\DoxyCodeLine{00174\ \ \ \ \ this-\/>mRangesSteps.assign(\ rhs.mRangesSteps.begin(),\ rhs.mRangesSteps.end());}
\DoxyCodeLine{00175\ \ \ \ \ this-\/>mRangesPercents.assign(\ rhs.mRangesPercents.begin(),\ rhs.mRangesPercents.end());}
\DoxyCodeLine{00176\ \ \ \ \ this-\/>mRangesStepsCount.assign(\ rhs.mRangesStepsCount.begin(),\ rhs.mRangesStepsCount.end());}
\DoxyCodeLine{00177\ }
\DoxyCodeLine{00178\ \ \ \ \ \textcolor{keywordflow}{return}\ *\textcolor{keyword}{this};}
\DoxyCodeLine{00179\ \}}
\DoxyCodeLine{00180\ }
\DoxyCodeLine{00181\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00182\ T\ \ \ \mbox{\hyperlink{a01913_a67b913916d7296ad69bf262363704e6f}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::Round}}(\textcolor{keywordtype}{double}\ iValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00183\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00184\ \ \ \ \ \textcolor{keywordflow}{return}\ ((0\ >=\ RealPrecision)\ ?\ \ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(iValue)\ :}
\DoxyCodeLine{00185\ \ \ \ \ \ \ \ \ \ \ \ \ (0\ <=\ iValue)\ ?\ \ \ \ \ \ \ \ \ floor(\ iValue*RealPrecision\ +\ 0.5f\ )\ /\ RealPrecision\ :}
\DoxyCodeLine{00186\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ceil(\ iValue*RealPrecision\ -\/\ 0.5f\ )\ /\ RealPrecision}
\DoxyCodeLine{00187\ \ \ \ \ \ \ \ \ \ \ \ \ );}
\DoxyCodeLine{00188\ \}}
\DoxyCodeLine{00189\ }
\DoxyCodeLine{00190\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00191\ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>}}*\ \ \ \ \ \mbox{\hyperlink{a01913_a787f7649ff4b94af1642bfa0198007a2}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00192\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00193\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01913}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00194\ \}}
\DoxyCodeLine{00195\ }
\DoxyCodeLine{00196\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00197\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01913_aecea5b86d9f5c6a5b1af87ba04d8473d}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00198\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00199\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00200\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00201\ \ \ \ \ }
\DoxyCodeLine{00202\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision)}
\DoxyCodeLine{00203\ \ \ \ \ \ \ \ \ value\ =\ Round(value);\ \ \ \ \ \ \ \textcolor{comment}{//reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00204\ \ \ \ \ }
\DoxyCodeLine{00205\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00206\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00207\ \ \ \ \ }
\DoxyCodeLine{00208\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00209\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00210\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00211\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00212\ \ \ \ \ }
\DoxyCodeLine{00213\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00214\ \}}
\DoxyCodeLine{00215\ }
\DoxyCodeLine{00216\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00217\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01913_a50b58efa795c9973ab199d4f5bb31de4}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ \ \ \ \ \ const}}
\DoxyCodeLine{00218\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00219\ \ \ \ \ \textcolor{keywordtype}{double}\ percentTotal\ =\ normalizedValue;}
\DoxyCodeLine{00220\ }
\DoxyCodeLine{00221\ \ \ \ \ \textcolor{keywordtype}{double}\ percent\ =\ 0.0;}
\DoxyCodeLine{00222\ \ \ \ \ \textcolor{keywordtype}{long}\ i\ =\ 0;}
\DoxyCodeLine{00223\ \ \ \ \ \textcolor{keywordflow}{for}\ (;\ i\ <\ mNumRanges;\ i++)}
\DoxyCodeLine{00224\ \ \ \ \ \{}
\DoxyCodeLine{00225\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((percentTotal\ >=\ percent)\ \&\&\ (percentTotal\ <\ (percent\ +\ mRangesPercents.at(\ i\ )\ )))}
\DoxyCodeLine{00226\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00227\ \ \ \ \ \ \ \ \ percent\ +=\ mRangesPercents.at(\ i\ );}
\DoxyCodeLine{00228\ \ \ \ \ \}}
\DoxyCodeLine{00229\ }
\DoxyCodeLine{00230\ \ \ \ \ \textcolor{keywordtype}{double}\ extValue;}
\DoxyCodeLine{00231\ \ \ \ \ \textcolor{keywordflow}{if}\ (i\ ==\ mNumRanges)}
\DoxyCodeLine{00232\ \ \ \ \ \ \ \ \ extValue\ =\ mMaxValue;\ \ \ \textcolor{comment}{//\ our\ control\ is\ 100\%\ of\ maximum}}
\DoxyCodeLine{00233\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00234\ \ \ \ \ \ \ \ \ extValue\ =\ mRanges.at(i)\ +\ ((mRanges.at(i+1)\ -\/\ mRanges.at(i))*(percentTotal\ -\/\ percent))\ /\ (mRangesPercents.at(i));}
\DoxyCodeLine{00235\ }
\DoxyCodeLine{00236\ \ \ \ \ T\ realValue\ =\ T(extValue);}
\DoxyCodeLine{00237\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ mUseSmartRounding\ )}
\DoxyCodeLine{00238\ \ \ \ \ \ \ \ \ realValue\ =\ SmartRound(extValue);\ \ \ \ \ \ \ \textcolor{comment}{//reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00239\ }
\DoxyCodeLine{00240\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00241\ \}}
\DoxyCodeLine{00242\ }
\DoxyCodeLine{00243\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00244\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01913_a457a42ac3e78debf4c595ac1afeec7cf}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00245\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00246\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00247\ }
\DoxyCodeLine{00248\ \ \ \ \ \textcolor{keywordtype}{double}\ percentTotal\ =\ 0.0;}
\DoxyCodeLine{00249\ \ \ \ \ \textcolor{keywordtype}{long}\ i\ =\ 0;}
\DoxyCodeLine{00250\ \ \ \ \ \textcolor{keywordflow}{for}\ (;\ i\ <\ mNumRanges;\ i++)}
\DoxyCodeLine{00251\ \ \ \ \ \{}
\DoxyCodeLine{00252\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((realValue\ >=\ mRanges[i])\ \&\&\ (realValue\ <\ mRanges[i+1]))}
\DoxyCodeLine{00253\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00254\ \ \ \ \ \ \ \ \ percentTotal\ +=\ mRangesPercents[i];}
\DoxyCodeLine{00255\ \ \ \ \ \}}
\DoxyCodeLine{00256\ }
\DoxyCodeLine{00257\ \ \ \ \ \textcolor{keywordflow}{if}\ (i\ ==\ mNumRanges)}
\DoxyCodeLine{00258\ \ \ \ \ \ \ \ \ percentTotal\ =\ 1.0;\ \ \ \ \ \textcolor{comment}{//\ our\ control\ is\ 100\%\ of\ maximum}}
\DoxyCodeLine{00259\ \ \ \ \ \textcolor{keywordflow}{else}\ \textcolor{keywordflow}{if}\ (mRanges.at(i\ +\ 1)\ ==\ mRanges.at(i))}
\DoxyCodeLine{00260\ \ \ \ \ \ \ \ \ ;\ \textcolor{comment}{//\ no\ action;\ total\ percent\ does\ not\ change}}
\DoxyCodeLine{00261\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00262\ \ \ \ \ \ \ \ \ percentTotal\ +=\ (realValue\ -\/\ mRanges.at(i))/(mRanges.at(i\ +\ 1)\ -\/\ mRanges.at(i))\ *\ mRangesPercents.at(i);}
\DoxyCodeLine{00263\ }
\DoxyCodeLine{00264\ \ \ \ \ \textcolor{keywordtype}{double}\ normalizedValue\ =\ percentTotal;}
\DoxyCodeLine{00265\ \ \ \ \ \textcolor{keywordflow}{return}\ normalizedValue;}
\DoxyCodeLine{00266\ \}}
\DoxyCodeLine{00267\ }
\DoxyCodeLine{00268\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00269\ T\ \ \ \mbox{\hyperlink{a01913_a4b0c76eb0cd262598dbe5118068fbefb}{AAX\_CRangeTaperDelegate<T,\ RealPrecision>::SmartRound}}(\textcolor{keywordtype}{double}\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00270\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00271\ \ \ \ \ int32\_t\ i\ =\ 0;}
\DoxyCodeLine{00272\ \ \ \ \ \textcolor{keywordflow}{for}\ (;\ i\ <\ mNumRanges;\ i++)}
\DoxyCodeLine{00273\ \ \ \ \ \{}
\DoxyCodeLine{00274\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ ((value\ >=\ mRanges.at(i))\ \&\&\ (value\ <\ mRanges.at(i\ +\ 1)\ ))}
\DoxyCodeLine{00275\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00276\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{if}\ (\ i\ ==\ mNumRanges\ -\/\ 1\ )}
\DoxyCodeLine{00277\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00278\ \ \ \ \ \}}
\DoxyCodeLine{00279\ }
\DoxyCodeLine{00280\ \ \ \ \ int32\_t\ longVal\ =\ 0;}
\DoxyCodeLine{00281\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >=\ 0)}
\DoxyCodeLine{00282\ \ \ \ \ \ \ \ \ longVal\ =\ int32\_t(floor(value\ /\ mRangesSteps.at(i)\ +\ 0.5));}
\DoxyCodeLine{00283\ \ \ \ \ \textcolor{keywordflow}{else}}
\DoxyCodeLine{00284\ \ \ \ \ \ \ \ \ longVal\ =\ int32\_t(ceil(value\ /\ mRangesSteps.at(i)\ -\/\ 0.5));}
\DoxyCodeLine{00285\ }
\DoxyCodeLine{00286\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{double}\textcolor{keyword}{>}(longVal)\ *\ mRangesSteps.at(i);}
\DoxyCodeLine{00287\ \}}
\DoxyCodeLine{00288\ }
\DoxyCodeLine{00289\ }
\DoxyCodeLine{00290\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
