\hypertarget{a00698_source}{}\doxysection{AAX\+\_\+\+CState\+Taper\+Delegate.\+h}
\label{a00698_source}\index{AAX\_CStateTaperDelegate.h@{AAX\_CStateTaperDelegate.h}}
\mbox{\hyperlink{a00698}{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-\/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\_CSTATETAPERDELEGATE\_H}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\#define\ AAX\_CSTATETAPERDELEGATE\_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\ }
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00055\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00056\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01942}{AAX\_CStateTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02338}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00057\ \{}
\DoxyCodeLine{00058\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00066\ \ \ \ \ \mbox{\hyperlink{a01942}{AAX\_CStateTaperDelegate}}(T\ minValue=0,\ T\ maxValue=1);}
\DoxyCodeLine{00067\ \ \ \ \ }
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00069\ \ \ \ \ \mbox{\hyperlink{a01942}{AAX\_CStateTaperDelegate<T>}}*\ \ \ \mbox{\hyperlink{a01942_a4a7f0c8d7a59a348d128a0bf750fea29}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00070\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01942_a4638babda379cc5bbf215f63c3f0bb08}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00071\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01942_aeb4ff10c4750236caa03be5f04c9eaba}{GetMaximumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00072\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01942_a6caec4112e24a711c9b7fdefa6384462}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00073\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01942_a2a067bafa1822b1cf19816c64ce5e2d3}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00074\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01942_af693a54c4a61ebc507fcc1a212585824}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00075\ \ \ \ \ }
\DoxyCodeLine{00076\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00077\ \ \ \ \ T\ \ \ mMinValue;}
\DoxyCodeLine{00078\ \ \ \ \ T\ \ \ mMaxValue;}
\DoxyCodeLine{00079\ \};}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00082\ \mbox{\hyperlink{a01942_a99bdadedcd4de8f8f7a88536a6c262d2}{AAX\_CStateTaperDelegate<T>::AAX\_CStateTaperDelegate}}(T\ minValue,\ T\ maxValue)\ \ :\ \ \mbox{\hyperlink{a02338}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00083\ \ \ \ \ mMinValue(minValue),}
\DoxyCodeLine{00084\ \ \ \ \ mMaxValue(maxValue)}
\DoxyCodeLine{00085\ \{}
\DoxyCodeLine{00086\ }
\DoxyCodeLine{00087\ \}}
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00089\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00090\ \mbox{\hyperlink{a01942}{AAX\_CStateTaperDelegate<T>}}*\ \ \ \ \ \ \ \mbox{\hyperlink{a01942_a4a7f0c8d7a59a348d128a0bf750fea29}{AAX\_CStateTaperDelegate<T>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00091\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01942}{AAX\_CStateTaperDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00093\ \}}
\DoxyCodeLine{00094\ }
\DoxyCodeLine{00095\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00096\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01942_a6caec4112e24a711c9b7fdefa6384462}{AAX\_CStateTaperDelegate<T>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ \ \ const}}
\DoxyCodeLine{00097\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00098\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ }
\DoxyCodeLine{00101\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00103\ \ \ \ \ }
\DoxyCodeLine{00104\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00106\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00108\ \ \ \ \ }
\DoxyCodeLine{00109\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00110\ \}}
\DoxyCodeLine{00111\ }
\DoxyCodeLine{00112\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00113\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01942_a2a067bafa1822b1cf19816c64ce5e2d3}{AAX\_CStateTaperDelegate<T>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00114\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordtype}{double}\ doubleRealValue\ =\ normalizedValue\ *\ (double(mMaxValue)\ -\/\ double(mMinValue))\ +\ \textcolor{keywordtype}{double}(mMinValue);}
\DoxyCodeLine{00116\ \ \ \ \ \textcolor{keywordflow}{if}\ (\ doubleRealValue\ >=\ 0\ )}
\DoxyCodeLine{00117\ \ \ \ \ \ \ \ \ doubleRealValue\ +=\ 0.5;}
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keywordflow}{else}\ doubleRealValue\ -\/=\ 0.5;}
\DoxyCodeLine{00119\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(\textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(doubleRealValue));}
\DoxyCodeLine{00120\ \}}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00122\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T>}
\DoxyCodeLine{00123\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01942_af693a54c4a61ebc507fcc1a212585824}{AAX\_CStateTaperDelegate<T>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00124\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00125\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00126\ \ \ \ \ \textcolor{keywordtype}{double}\ normalizedValue\ =\ (mMaxValue\ ==\ mMinValue)\ ?\ 0.5\ :\ (\textcolor{keywordtype}{double}(realValue)\ -\/\ double(mMinValue))\ /\ (\textcolor{keywordtype}{double}(mMaxValue)\ -\/\ double(mMinValue));}
\DoxyCodeLine{00127\ \ \ \ \ \textcolor{keywordflow}{return}\ normalizedValue;}
\DoxyCodeLine{00128\ \}}
\DoxyCodeLine{00129\ \ \ \ \ }
\DoxyCodeLine{00130\ }
\DoxyCodeLine{00131\ }
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//AAX\_CSTATETAPERDELEGATE\_H}}

\end{DoxyCode}
