\hypertarget{a00782_source}{}\doxysection{AAX\+\_\+\+CLinear\+Taper\+Delegate.\+h}
\label{a00782_source}\index{AAX\_CLinearTaperDelegate.h@{AAX\_CLinearTaperDelegate.h}}
\mbox{\hyperlink{a00782}{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\_CLINEARTAPERDELEGATE\_H}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ AAX\_CLINEARTAPERDELEGATE\_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{00056\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision=0>}
\DoxyCodeLine{00057\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01849}{AAX\_CLinearTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00058\ \{}
\DoxyCodeLine{00059\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00067\ \ \ \ \ \mbox{\hyperlink{a01849}{AAX\_CLinearTaperDelegate}}(T\ minValue=0,\ T\ maxValue=1);}
\DoxyCodeLine{00068\ \ \ \ \ }
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{comment}{//Virtual\ AAX\_ITaperDelegate\ Overrides}}
\DoxyCodeLine{00070\ \ \ \ \ \mbox{\hyperlink{a01849}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>}}*\ \ \ \mbox{\hyperlink{a01849_a022c70f963f1fb15238d21199d2d0ed9}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00071\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01849_aa8874bf8cb7b62ae363cb3d9587efb12}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00072\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01849_a52dccdec4565f1057a4a5b304fc51161}{GetMaximumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00073\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01849_aad9ea52c4f3c4cae45b6d5309c2833de}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00074\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01849_a2e38e1451e418425aceae090f2420e3e}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00075\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01849_a7949f3c1608fd85848ac4c09c0107690}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00076\ \ \ \ \ }
\DoxyCodeLine{00077\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00078\ \ \ \ \ T\ \ \ \mbox{\hyperlink{a01849_a08b3b4c042385e73ce79e94c0dbf54ce}{Round}}(\textcolor{keywordtype}{double}\ iValue)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00079\ }
\DoxyCodeLine{00080\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00081\ \ \ \ \ T\ \ \ mMinValue;}
\DoxyCodeLine{00082\ \ \ \ \ T\ \ \ mMaxValue;}
\DoxyCodeLine{00083\ \};}
\DoxyCodeLine{00084\ }
\DoxyCodeLine{00085\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00086\ T\ \ \ \mbox{\hyperlink{a01849_a08b3b4c042385e73ce79e94c0dbf54ce}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>::Round}}(\textcolor{keywordtype}{double}\ iValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00087\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keywordtype}{double}\ precision\ =\ RealPrecision;}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keywordflow}{if}\ (precision\ >\ 0)}
\DoxyCodeLine{00090\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(floor(iValue\ *\ precision\ +\ 0.5)\ /\ precision);}
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(iValue);}
\DoxyCodeLine{00092\ \}}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00095\ \mbox{\hyperlink{a01849_a790c48a2dd573b3304cf4cc117d97a95}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>::AAX\_CLinearTaperDelegate}}(T\ minValue,\ T\ maxValue)\ \ :\ \ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00096\ \ \ \ \ mMinValue(minValue),}
\DoxyCodeLine{00097\ \ \ \ \ mMaxValue(maxValue)}
\DoxyCodeLine{00098\ \{}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \}}
\DoxyCodeLine{00101\ }
\DoxyCodeLine{00102\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00103\ \mbox{\hyperlink{a01849}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>}}*\ \ \ \ \ \ \ \mbox{\hyperlink{a01849_a022c70f963f1fb15238d21199d2d0ed9}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00104\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00105\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01849}{AAX\_CLinearTaperDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00106\ \}}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00108\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00109\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01849_aad9ea52c4f3c4cae45b6d5309c2833de}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ \ \ const}}
\DoxyCodeLine{00110\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00111\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00112\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00113\ \ \ \ \ }
\DoxyCodeLine{00114\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision)}
\DoxyCodeLine{00115\ \ \ \ \ \ \ \ \ value\ =\ Round(value);\ \ \ \ \ \ \ \textcolor{comment}{//reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00116\ \ \ \ \ }
\DoxyCodeLine{00117\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00119\ \ \ \ \ }
\DoxyCodeLine{00120\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00121\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00122\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00123\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00124\ \ \ \ \ }
\DoxyCodeLine{00125\ \ \ \ \ \textcolor{keywordflow}{return}\ value;\ \ \ \ \ \ \ }
\DoxyCodeLine{00126\ \}}
\DoxyCodeLine{00127\ }
\DoxyCodeLine{00128\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00129\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01849_a2e38e1451e418425aceae090f2420e3e}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00130\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00131\ \ \ \ \ \textcolor{keywordtype}{double}\ doubleRealValue\ =\ normalizedValue\ *\ (double(mMaxValue)\ -\/\ double(mMinValue))\ +\ \textcolor{keywordtype}{double}(mMinValue);}
\DoxyCodeLine{00132\ \ \ \ \ }
\DoxyCodeLine{00133\ \ \ \ \ \textcolor{comment}{//\ If\ RealPrecision\ is\ set,\ reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00134\ \ \ \ \ T\ realValue\ =\ (0\ !=\ RealPrecision)\ ?\ Round(doubleRealValue)\ :\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(doubleRealValue);}
\DoxyCodeLine{00135\ \ \ \ \ }
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00137\ \}}
\DoxyCodeLine{00138\ }
\DoxyCodeLine{00139\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00140\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01849_a7949f3c1608fd85848ac4c09c0107690}{AAX\_CLinearTaperDelegate<T,\ RealPrecision>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00141\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00142\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00143\ \ \ \ \ \textcolor{keywordtype}{double}\ normalizedValue\ =\ (mMaxValue\ ==\ mMinValue)\ ?\ 0.5\ :\ (\textcolor{keywordtype}{double}(realValue)\ -\/\ double(mMinValue))\ /\ (\textcolor{keywordtype}{double}(mMaxValue)\ -\/\ double(mMinValue));}
\DoxyCodeLine{00144\ \ \ \ \ \textcolor{keywordflow}{return}\ normalizedValue;}
\DoxyCodeLine{00145\ \}}
\DoxyCodeLine{00146\ \ \ \ \ }
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00148\ }
\DoxyCodeLine{00149\ }
\DoxyCodeLine{00150\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CLINEARTAPERDELEGATE\_H}}

\end{DoxyCode}
