\hypertarget{a00662_source}{}\doxysection{AAX\+\_\+\+CLog\+Taper\+Delegate.\+h}
\label{a00662_source}\index{AAX\_CLogTaperDelegate.h@{AAX\_CLogTaperDelegate.h}}
\mbox{\hyperlink{a00662}{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{00018\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ }
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#ifndef\ AAX\_CLOGTAPERDELEGATE\_H}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#define\ AAX\_CLOGTAPERDELEGATE\_H}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00500}{AAX\_ITaperDelegate.h}}"{}}}
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00575}{AAX\_UtilsNative.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(),\ log()}}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ }
\DoxyCodeLine{00031\ }
\DoxyCodeLine{00057\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision=1000>}
\DoxyCodeLine{00058\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01853}{AAX\_CLogTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00059\ \{}
\DoxyCodeLine{00060\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00068\ \ \ \ \ \mbox{\hyperlink{a01853}{AAX\_CLogTaperDelegate}}(T\ minValue=0,\ T\ maxValue=1);}
\DoxyCodeLine{00069\ \ \ \ \ }
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00071\ \ \ \ \ \mbox{\hyperlink{a01853}{AAX\_CLogTaperDelegate<T,\ RealPrecision>}}*\ \mbox{\hyperlink{a01853_afac51287c0ecb4490fb75064577d8292}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00072\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01853_a5c142294e18dcfac6069e4e5cf04277f}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00073\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01853_a758cba19d16615578682d0c6af7d0496}{GetMaximumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00074\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01853_ae0c5ef04b9f6e62cff0d73fb9aad7318}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00075\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01853_a363e09fe8517d4a5ecb151483f011752}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00076\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01853_abcc5e51eebe04ff347de512a103880de}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00533_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00077\ \ \ \ \ }
\DoxyCodeLine{00078\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00079\ \ \ \ \ T\ \ \ \mbox{\hyperlink{a01853_a82712265ea02e84afbc89d2bd73ad0c3}{Round}}(\textcolor{keywordtype}{double}\ iValue)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00080\ }
\DoxyCodeLine{00081\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00082\ \ \ \ \ T\ \ \ mMinValue;}
\DoxyCodeLine{00083\ \ \ \ \ T\ \ \ mMaxValue;}
\DoxyCodeLine{00084\ \};}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00087\ T\ \ \ \mbox{\hyperlink{a01853_a82712265ea02e84afbc89d2bd73ad0c3}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::Round}}(\textcolor{keywordtype}{double}\ iValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00088\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keywordtype}{double}\ precision\ =\ RealPrecision;}
\DoxyCodeLine{00090\ \ \ \ \ \textcolor{keywordflow}{if}\ (precision\ >\ 0)}
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(floor(iValue\ *\ precision\ +\ 0.5)\ /\ precision);}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(iValue);}
\DoxyCodeLine{00093\ \}}
\DoxyCodeLine{00094\ }
\DoxyCodeLine{00095\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00096\ \mbox{\hyperlink{a01853_a757656707e996759b995e7fc0f74d820}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::AAX\_CLogTaperDelegate}}(T\ minValue,\ T\ maxValue)\ \ :\ \ \mbox{\hyperlink{a02313}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00097\ \ \ \ \ mMinValue(minValue),}
\DoxyCodeLine{00098\ \ \ \ \ mMaxValue(maxValue)}
\DoxyCodeLine{00099\ \{}
\DoxyCodeLine{00100\ }
\DoxyCodeLine{00101\ \}}
\DoxyCodeLine{00102\ }
\DoxyCodeLine{00103\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00104\ \mbox{\hyperlink{a01853}{AAX\_CLogTaperDelegate<T,\ RealPrecision>}}*\ \ \ \ \ \mbox{\hyperlink{a01853_afac51287c0ecb4490fb75064577d8292}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00105\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00106\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01853}{AAX\_CLogTaperDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00107\ \}}
\DoxyCodeLine{00108\ }
\DoxyCodeLine{00109\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00110\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01853_ae0c5ef04b9f6e62cff0d73fb9aad7318}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00111\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00112\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00113\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00114\ \ \ \ \ }
\DoxyCodeLine{00115\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision)}
\DoxyCodeLine{00116\ \ \ \ \ \ \ \ \ value\ =\ Round(value);\ \ \ \ \ \ \ \textcolor{comment}{//reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00117\ \ \ \ \ }
\DoxyCodeLine{00118\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00119\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00120\ \ \ \ \ }
\DoxyCodeLine{00121\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00122\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00123\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00124\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00125\ \ \ \ \ }
\DoxyCodeLine{00126\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00127\ \}}
\DoxyCodeLine{00128\ }
\DoxyCodeLine{00129\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00130\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01853_a363e09fe8517d4a5ecb151483f011752}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00131\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keywordtype}{double}\ minLog\ =\ \mbox{\hyperlink{a00935_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMinValue));}
\DoxyCodeLine{00133\ \ \ \ \ \textcolor{keywordtype}{double}\ maxLog\ =\ \mbox{\hyperlink{a00935_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMaxValue));}
\DoxyCodeLine{00134\ }
\DoxyCodeLine{00135\ \ \ \ \ \textcolor{keywordtype}{double}\ doubleRealValue\ =\ exp(normalizedValue\ *\ (maxLog\ -\/\ minLog)\ +\ minLog);}
\DoxyCodeLine{00136\ \ \ \ \ T\ realValue\ =\ (T)\ doubleRealValue;}
\DoxyCodeLine{00137\ \ \ \ \ }
\DoxyCodeLine{00138\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00139\ \}}
\DoxyCodeLine{00140\ }
\DoxyCodeLine{00141\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00142\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01853_abcc5e51eebe04ff347de512a103880de}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00143\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00144\ \ \ \ \ \textcolor{keywordtype}{double}\ minLog\ =\ \mbox{\hyperlink{a00935_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMinValue));}
\DoxyCodeLine{00145\ \ \ \ \ \textcolor{keywordtype}{double}\ maxLog\ =\ \mbox{\hyperlink{a00935_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMaxValue));}
\DoxyCodeLine{00146\ }
\DoxyCodeLine{00147\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00148\ \ \ \ \ \textcolor{keywordtype}{double}\ normalizedValue\ =\ (maxLog\ ==\ minLog)\ ?\ 0.5\ :\ (\mbox{\hyperlink{a00935_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(realValue))\ -\/\ minLog)\ /\ (maxLog\ -\/\ minLog);}
\DoxyCodeLine{00149\ \ \ \ \ \textcolor{keywordflow}{return}\ normalizedValue;}
\DoxyCodeLine{00150\ \}}
\DoxyCodeLine{00151\ \ \ \ \ }
\DoxyCodeLine{00152\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ AAX\_CLOGTAPERDELEGATE\_H}}

\end{DoxyCode}
