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

\end{DoxyCode}
