\hypertarget{a00674_source}{}\doxysection{AAX\+\_\+\+CLog\+Taper\+Delegate.\+h}
\label{a00674_source}\index{AAX\_CLogTaperDelegate.h@{AAX\_CLogTaperDelegate.h}}
\mbox{\hyperlink{a00674}{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{00031\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00032\ }
\DoxyCodeLine{00033\ }
\DoxyCodeLine{00034\ \textcolor{preprocessor}{\#ifndef\ AAX\_CLOGTAPERDELEGATE\_H}}
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#define\ AAX\_CLOGTAPERDELEGATE\_H}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00509}{AAX\_ITaperDelegate.h}}"{}}}
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{a00584}{AAX\_UtilsNative.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(),\ log()}}
\DoxyCodeLine{00042\ }
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00070\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision=1000>}
\DoxyCodeLine{00071\ \textcolor{keyword}{class\ }\mbox{\hyperlink{a01866}{AAX\_CLogTaperDelegate}}\ :\ \textcolor{keyword}{public}\ \mbox{\hyperlink{a02338}{AAX\_ITaperDelegate}}<T>}
\DoxyCodeLine{00072\ \{}
\DoxyCodeLine{00073\ \textcolor{keyword}{public}:\ }
\DoxyCodeLine{00081\ \ \ \ \ \mbox{\hyperlink{a01866}{AAX\_CLogTaperDelegate}}(T\ minValue=0,\ T\ maxValue=1);}
\DoxyCodeLine{00082\ \ \ \ \ }
\DoxyCodeLine{00083\ \ \ \ \ \textcolor{comment}{//Virtual\ Overrides}}
\DoxyCodeLine{00084\ \ \ \ \ \mbox{\hyperlink{a01866}{AAX\_CLogTaperDelegate<T,\ RealPrecision>}}*\ \mbox{\hyperlink{a01866_afac51287c0ecb4490fb75064577d8292}{Clone}}()\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00085\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01866_a5c142294e18dcfac6069e4e5cf04277f}{GetMinimumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMinValue;\ \}}
\DoxyCodeLine{00086\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01866_a758cba19d16615578682d0c6af7d0496}{GetMaximumValue}}()\ \ \ \ const\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \{\ \textcolor{keywordflow}{return}\ mMaxValue;\ \}}
\DoxyCodeLine{00087\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01866_ae0c5ef04b9f6e62cff0d73fb9aad7318}{ConstrainRealValue}}(T\ value)\ \ \ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00088\ \ \ \ \ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01866_a363e09fe8517d4a5ecb151483f011752}{NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01866_abcc5e51eebe04ff347de512a103880de}{RealToNormalized}}(T\ realValue)\ \textcolor{keyword}{const}\ \mbox{\hyperlink{a00542_ac2f24a5172689ae684344abdcce55463}{AAX\_OVERRIDE}};}
\DoxyCodeLine{00090\ \ \ \ \ }
\DoxyCodeLine{00091\ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00092\ \ \ \ \ T\ \ \ \mbox{\hyperlink{a01866_a82712265ea02e84afbc89d2bd73ad0c3}{Round}}(\textcolor{keywordtype}{double}\ iValue)\ \textcolor{keyword}{const};}
\DoxyCodeLine{00093\ }
\DoxyCodeLine{00094\ \textcolor{keyword}{private}:}
\DoxyCodeLine{00095\ \ \ \ \ T\ \ \ mMinValue;}
\DoxyCodeLine{00096\ \ \ \ \ T\ \ \ mMaxValue;}
\DoxyCodeLine{00097\ \};}
\DoxyCodeLine{00098\ }
\DoxyCodeLine{00099\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00100\ T\ \ \ \mbox{\hyperlink{a01866_a82712265ea02e84afbc89d2bd73ad0c3}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::Round}}(\textcolor{keywordtype}{double}\ iValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00101\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00102\ \ \ \ \ \textcolor{keywordtype}{double}\ precision\ =\ RealPrecision;}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keywordflow}{if}\ (precision\ >\ 0)}
\DoxyCodeLine{00104\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(floor(iValue\ *\ precision\ +\ 0.5)\ /\ precision);}
\DoxyCodeLine{00105\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{static\_cast<}T\textcolor{keyword}{>}(iValue);}
\DoxyCodeLine{00106\ \}}
\DoxyCodeLine{00107\ }
\DoxyCodeLine{00108\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00109\ \mbox{\hyperlink{a01866_a757656707e996759b995e7fc0f74d820}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::AAX\_CLogTaperDelegate}}(T\ minValue,\ T\ maxValue)\ \ :\ \ \mbox{\hyperlink{a02338}{AAX\_ITaperDelegate}}<T>(),}
\DoxyCodeLine{00110\ \ \ \ \ mMinValue(minValue),}
\DoxyCodeLine{00111\ \ \ \ \ mMaxValue(maxValue)}
\DoxyCodeLine{00112\ \{}
\DoxyCodeLine{00113\ }
\DoxyCodeLine{00114\ \}}
\DoxyCodeLine{00115\ }
\DoxyCodeLine{00116\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00117\ \mbox{\hyperlink{a01866}{AAX\_CLogTaperDelegate<T,\ RealPrecision>}}*\ \ \ \ \ \mbox{\hyperlink{a01866_afac51287c0ecb4490fb75064577d8292}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::Clone}}()\textcolor{keyword}{\ const}}
\DoxyCodeLine{00118\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00119\ \ \ \ \ \textcolor{keywordflow}{return}\ \textcolor{keyword}{new}\ \mbox{\hyperlink{a01866}{AAX\_CLogTaperDelegate}}(*\textcolor{keyword}{this});}
\DoxyCodeLine{00120\ \}}
\DoxyCodeLine{00121\ }
\DoxyCodeLine{00122\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00123\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01866_ae0c5ef04b9f6e62cff0d73fb9aad7318}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::ConstrainRealValue}}(T\ value)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00124\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00125\ \ \ \ \ \textcolor{keywordflow}{if}\ (mMinValue\ ==\ mMaxValue)}
\DoxyCodeLine{00126\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ mMinValue;}
\DoxyCodeLine{00127\ \ \ \ \ }
\DoxyCodeLine{00128\ \ \ \ \ \textcolor{keywordflow}{if}\ (RealPrecision)}
\DoxyCodeLine{00129\ \ \ \ \ \ \ \ \ value\ =\ Round(value);\ \ \ \ \ \ \ \textcolor{comment}{//reduce\ the\ precision\ to\ get\ proper\ rounding\ behavior\ with\ integers.}}
\DoxyCodeLine{00130\ \ \ \ \ }
\DoxyCodeLine{00131\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ highValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMaxValue\ :\ mMinValue;}
\DoxyCodeLine{00132\ \ \ \ \ \textcolor{keyword}{const}\ T\&\ lowValue\ =\ mMaxValue\ >\ mMinValue\ ?\ mMinValue\ :\ mMaxValue;}
\DoxyCodeLine{00133\ \ \ \ \ }
\DoxyCodeLine{00134\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ >\ highValue)}
\DoxyCodeLine{00135\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ highValue;}
\DoxyCodeLine{00136\ \ \ \ \ \textcolor{keywordflow}{if}\ (value\ <\ lowValue)}
\DoxyCodeLine{00137\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{return}\ lowValue;}
\DoxyCodeLine{00138\ \ \ \ \ }
\DoxyCodeLine{00139\ \ \ \ \ \textcolor{keywordflow}{return}\ value;}
\DoxyCodeLine{00140\ \}}
\DoxyCodeLine{00141\ }
\DoxyCodeLine{00142\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00143\ T\ \ \ \ \ \ \ \mbox{\hyperlink{a01866_a363e09fe8517d4a5ecb151483f011752}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::NormalizedToReal}}(\textcolor{keywordtype}{double}\ normalizedValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00144\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00145\ \ \ \ \ \textcolor{keywordtype}{double}\ minLog\ =\ \mbox{\hyperlink{a00948_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMinValue));}
\DoxyCodeLine{00146\ \ \ \ \ \textcolor{keywordtype}{double}\ maxLog\ =\ \mbox{\hyperlink{a00948_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMaxValue));}
\DoxyCodeLine{00147\ }
\DoxyCodeLine{00148\ \ \ \ \ \textcolor{keywordtype}{double}\ doubleRealValue\ =\ exp(normalizedValue\ *\ (maxLog\ -\/\ minLog)\ +\ minLog);}
\DoxyCodeLine{00149\ \ \ \ \ T\ realValue\ =\ (T)\ doubleRealValue;}
\DoxyCodeLine{00150\ \ \ \ \ }
\DoxyCodeLine{00151\ \ \ \ \ \textcolor{keywordflow}{return}\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00152\ \}}
\DoxyCodeLine{00153\ }
\DoxyCodeLine{00154\ \textcolor{keyword}{template}\ <\textcolor{keyword}{typename}\ T,\ \textcolor{keywordtype}{int}32\_t\ RealPrecision>}
\DoxyCodeLine{00155\ \textcolor{keywordtype}{double}\ \ \mbox{\hyperlink{a01866_abcc5e51eebe04ff347de512a103880de}{AAX\_CLogTaperDelegate<T,\ RealPrecision>::RealToNormalized}}(T\ realValue)\textcolor{keyword}{\ const}}
\DoxyCodeLine{00156\ \textcolor{keyword}{}\{}
\DoxyCodeLine{00157\ \ \ \ \ \textcolor{keywordtype}{double}\ minLog\ =\ \mbox{\hyperlink{a00948_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMinValue));}
\DoxyCodeLine{00158\ \ \ \ \ \textcolor{keywordtype}{double}\ maxLog\ =\ \mbox{\hyperlink{a00948_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(mMaxValue));}
\DoxyCodeLine{00159\ }
\DoxyCodeLine{00160\ \ \ \ \ realValue\ =\ ConstrainRealValue(realValue);}
\DoxyCodeLine{00161\ \ \ \ \ \textcolor{keywordtype}{double}\ normalizedValue\ =\ (maxLog\ ==\ minLog)\ ?\ 0.5\ :\ (\mbox{\hyperlink{a00948_ae8de30637f08cd29bb0e27526ce9e21b}{AAX::SafeLog}}(\textcolor{keywordtype}{double}(realValue))\ -\/\ minLog)\ /\ (maxLog\ -\/\ minLog);}
\DoxyCodeLine{00162\ \ \ \ \ \textcolor{keywordflow}{return}\ normalizedValue;}
\DoxyCodeLine{00163\ \}}
\DoxyCodeLine{00164\ \ \ \ \ }
\DoxyCodeLine{00165\ \textcolor{preprocessor}{\#endif\ }\textcolor{comment}{//\ AAX\_CLOGTAPERDELEGATE\_H}}

\end{DoxyCode}
