\hypertarget{a00686_source}{}\doxysection{AAX\+\_\+\+CState\+Taper\+Delegate.\+h}
\label{a00686_source}\index{AAX\_CStateTaperDelegate.h@{AAX\_CStateTaperDelegate.h}}
\mbox{\hyperlink{a00686}{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\_CSTATETAPERDELEGATE\_H}}
\DoxyCodeLine{00023\ \textcolor{preprocessor}{\#define\ AAX\_CSTATETAPERDELEGATE\_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{00042\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00043\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01929}{AAX\_CStateTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00044\ \{}
\DoxyCodeLine{00045\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00053\ \ \ \ \ \mbox{\hyperlink{a01929}{AAX\_CStateTaperDelegate}}(T\ minValue=0,\ T\ maxValue=1);}
\DoxyCodeLine{00054\ \ \ \ \ }
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00056\ \ \ \ \ \mbox{\hyperlink{a01929}{AAX\_CStateTaperDelegate<T>}}*\ \ \ \mbox{\hyperlink{a01929_a4a7f0c8d7a59a348d128a0bf750fea29}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00057\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01929_a4638babda379cc5bbf215f63c3f0bb08}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00058\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01929_aeb4ff10c4750236caa03be5f04c9eaba}{GetMaximumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00059\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01929_a6caec4112e24a711c9b7fdefa6384462}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00060\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01929_a2a067bafa1822b1cf19816c64ce5e2d3}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00061\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01929_af693a54c4a61ebc507fcc1a212585824}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00062\ \ \ \ \ }
\DoxyCodeLine{00063\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00064\ \ \ \ \ T\ \ \ mMinValue;}
\DoxyCodeLine{00065\ \ \ \ \ T\ \ \ mMaxValue;}
\DoxyCodeLine{00066\ \};}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00069\ \mbox{\hyperlink{a01929_a99bdadedcd4de8f8f7a88536a6c262d2}{AAX\_CStateTaperDelegate<T>::AAX\_CStateTaperDelegate}}(T\ minValue,\ T\ maxValue)\ \ :\ \ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00070\ \ \ \ \ mMinValue(minValue),}
\DoxyCodeLine{00071\ \ \ \ \ mMaxValue(maxValue)}
\DoxyCodeLine{00072\ \{}
\DoxyCodeLine{00073\ }
\DoxyCodeLine{00074\ \}}
\DoxyCodeLine{00075\ }
\DoxyCodeLine{00076\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00077\ \mbox{\hyperlink{a01929}{AAX\_CStateTaperDelegate<T>}}*\ \ \ \ \ \ \ \mbox{\hyperlink{a01929_a4a7f0c8d7a59a348d128a0bf750fea29}{AAX\_CStateTaperDelegate<T>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00078\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00079\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01929}{AAX\_CStateTaperDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00080\ \}}
\DoxyCodeLine{00081\ }
\DoxyCodeLine{00082\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00083\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01929_a6caec4112e24a711c9b7fdefa6384462}{AAX\_CStateTaperDelegate<T>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ \ \ const}}
\DoxyCodeLine{00084\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00085\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00086\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00087\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00090\ \ \ \ \ }
\DoxyCodeLine{00091\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00092\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00093\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00095\ \ \ \ \ }
\DoxyCodeLine{00096\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00097\ \}}
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00099\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00100\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01929_a2a067bafa1822b1cf19816c64ce5e2d3}{AAX\_CStateTaperDelegate<T>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00101\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordtype}{double}\ doubleRealValue\ =\ normalizedValue\ *\ (double(mMaxValue)\ -\/\ double(mMinValue))\ +\ \textcolor{keywordtype}{double}(mMinValue);}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ doubleRealValue\ >=\ 0\ )}
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ doubleRealValue\ +=\ 0.5;}
\DoxyCodeLine{00105\ \ \ \ \ \textcolor{keywordflow}{else}\ doubleRealValue\ -\/=\ 0.5;}
\DoxyCodeLine{00106\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(\textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(doubleRealValue));}
\DoxyCodeLine{00107\ \}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00110\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01929_af693a54c4a61ebc507fcc1a212585824}{AAX\_CStateTaperDelegate<T>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00111\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00112\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00113\ \ \ \ \ \textcolor{keywordtype}{double}\ normalizedValue\ =\ (mMaxValue\ ==\ mMinValue)\ ?\ 0.5\ :\ (\textcolor{keywordtype}{double}(realValue)\ -\/\ double(mMinValue))\ /\ (\textcolor{keywordtype}{double}(mMaxValue)\ -\/\ double(mMinValue));}
\DoxyCodeLine{00114\ \ \ \ \ \textcolor{keywordflow}{return}\ normalizedValue;}
\DoxyCodeLine{00115\ \}}
\DoxyCodeLine{00116\ \ \ \ \ }
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00118\ }
\DoxyCodeLine{00119\ }
\DoxyCodeLine{00120\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CSTATETAPERDELEGATE\_H}}

\end{DoxyCode}
