\hypertarget{a00860_source}{}\doxysection{AAX\+\_\+\+Sample\+Rate\+Utils.\+h}
\label{a00860_source}\index{AAX\_SampleRateUtils.h@{AAX\_SampleRateUtils.h}}
\mbox{\hyperlink{a00860}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00002\ \textcolor{comment}{/*}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ \ Copyright\ 2009-\/2015,\ 2023\ Avid\ Technology,\ Inc.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ \ All\ rights\ reserved.}}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ \ }}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ \ CONFIDENTIAL:\ this\ document\ contains\ confidential\ information\ of\ Avid.\ Do}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ \ not\ disclose\ to\ any\ third\ party.\ Use\ of\ the\ information\ contained\ in\ this}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ document\ is\ subject\ to\ an\ Avid\ SDK\ license.}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ */}}
\DoxyCodeLine{00010\ }
\DoxyCodeLine{00017\ \textcolor{comment}{/*================================================================================================*/}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{keyword}{enum}\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3e}{ESRUtils}}}
\DoxyCodeLine{00021\ \{}
\DoxyCodeLine{00022\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eae974abf255ac5507a0c8163d0ebf9bcb}{eSRUtils\_48kRangeCoarse}}\ \ \ \ \ \ =\ 48000,}
\DoxyCodeLine{00023\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea376e9c46e970aa93e789445670b1d45f}{eSRUtils\_96kRangeCoarse}}\ \ \ \ \ \ =\ 96000,}
\DoxyCodeLine{00024\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eadc3653ea09f8a83c8222afc5a386e28f}{eSRUtils\_192kRangeCoarse}}\ \ \ \ =\ 192000,}
\DoxyCodeLine{00025\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eaec0fdd5b4e84f205ff16852740f18ea2}{eSRUtils\_48kRangeMin}}\ \ \ \ \ \ \ \ =\ 0,}
\DoxyCodeLine{00026\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea1676c77c5473c1f0b7e820150869d413}{eSRUtils\_48kRangeMax}}\ \ \ \ \ \ \ \ =\ 51000,}
\DoxyCodeLine{00027\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea858679d6660025243d5e9b0f06797f7f}{eSRUtils\_96kRangeMin}}\ \ \ \ \ \ \ \ =\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea1676c77c5473c1f0b7e820150869d413}{eSRUtils\_48kRangeMax}}+1,}
\DoxyCodeLine{00028\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eabc1086d9707a35f99ed52f59b6b14934}{eSRUtils\_96kRangeMax}}\ \ \ \ \ \ \ \ =\ 102000,}
\DoxyCodeLine{00029\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea675774f7e038af726de7561dcd3f314b}{eSRUtils\_192kRangeMin}}\ \ \ \ \ \ =\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eabc1086d9707a35f99ed52f59b6b14934}{eSRUtils\_96kRangeMax}}+1,}
\DoxyCodeLine{00030\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eaac7e670dc4a1cc396be2fd024f6a237f}{eSRUtils\_192kRangeMax}}\ \ \ \ \ \ =\ 204000,}
\DoxyCodeLine{00031\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eaa501e86b22b5be0d003d73ad5fd4e1f5}{eSRUtils\_48kIndex}}\ \ \ \ \ \ =\ 0,}
\DoxyCodeLine{00032\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea0cb96ccca8f89676f461df0054ee2678}{eSRUtils\_96kIndex}}\ \ \ \ \ \ =\ 1,}
\DoxyCodeLine{00033\ \ \ \ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eafdb7fb04ad5032eeccbeec8d26a4a04c}{eSRUtils\_192kIndex}}\ \ \ \ \ \ \ \ =\ 2}
\DoxyCodeLine{00034\ \};}
\DoxyCodeLine{00035\ \ \ \ \ }
\DoxyCodeLine{00036\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{a00860_ab463c18c13ba2c75b89da6c90f02d0f0}{CoarseSampleRate}}\ (\textcolor{keywordtype}{int}\ iRate)}
\DoxyCodeLine{00037\ \{}
\DoxyCodeLine{00038\ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ aCoarseRate\ =}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \ \ \ \ \ \ \ \ ((iRate\ >=\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eaec0fdd5b4e84f205ff16852740f18ea2}{eSRUtils\_48kRangeMin}})\ \&\&\ (iRate\ <=\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea1676c77c5473c1f0b7e820150869d413}{eSRUtils\_48kRangeMax}}))\ ?\ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eae974abf255ac5507a0c8163d0ebf9bcb}{eSRUtils\_48kRangeCoarse}}\ :}
\DoxyCodeLine{00041\ \ \ \ \ \ \ \ \ ((iRate\ >=\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea858679d6660025243d5e9b0f06797f7f}{eSRUtils\_96kRangeMin}})\ \&\&\ (iRate\ <=\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eabc1086d9707a35f99ed52f59b6b14934}{eSRUtils\_96kRangeMax}}))\ ?\ \ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea376e9c46e970aa93e789445670b1d45f}{eSRUtils\_96kRangeCoarse}}\ :}
\DoxyCodeLine{00042\ \ \ \ \ \ \ \ \ ((iRate\ >=\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea675774f7e038af726de7561dcd3f314b}{eSRUtils\_192kRangeMin}})\ \&\&\ (iRate\ <=\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eaac7e670dc4a1cc396be2fd024f6a237f}{eSRUtils\_192kRangeMax}}))\ ?\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eadc3653ea09f8a83c8222afc5a386e28f}{eSRUtils\_192kRangeCoarse}}\ :}
\DoxyCodeLine{00043\ \ \ \ \ \ \ \ \ 0;}
\DoxyCodeLine{00044\ }
\DoxyCodeLine{00045\ \ \ \ \ \textcolor{keywordflow}{if}\ (aCoarseRate\ ==\ 0)}
\DoxyCodeLine{00046\ \ \ \ \ \{}
\DoxyCodeLine{00047\ \textcolor{comment}{//\ \ \ \ \ \ throw\ std::runtime\_error\ ("{}unrecognized\ sample\ rate"{});}}
\DoxyCodeLine{00048\ \ \ \ \ \}}
\DoxyCodeLine{00049\ \ \ \ \ \textcolor{keywordflow}{return}\ aCoarseRate;}
\DoxyCodeLine{00050\ \}}
\DoxyCodeLine{00051\ }
\DoxyCodeLine{00052\ \textcolor{comment}{//Returns\ 1\ for\ 48k,\ 2\ for\ 96k,\ and\ 4\ for\ 192k\ gross\ samples\ rate.}}
\DoxyCodeLine{00053\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{a00860_a781f007f979a98d27156a4675fd853fa}{CoarseSampleRateFactor}}\ (\textcolor{keywordtype}{int}\ iRate)}
\DoxyCodeLine{00054\ \{}
\DoxyCodeLine{00055\ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ kMinCoarseSampleRate=\mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eae974abf255ac5507a0c8163d0ebf9bcb}{eSRUtils\_48kRangeCoarse}};}
\DoxyCodeLine{00056\ }
\DoxyCodeLine{00057\ \ \ \ \ \textcolor{keywordtype}{int}\ aCoarseRateFactor\ =\ \mbox{\hyperlink{a00860_ab463c18c13ba2c75b89da6c90f02d0f0}{CoarseSampleRate}}\ (iRate)/kMinCoarseSampleRate;}
\DoxyCodeLine{00058\ }
\DoxyCodeLine{00059\ \ \ \ \ \textcolor{keywordflow}{return}\ aCoarseRateFactor;}
\DoxyCodeLine{00060\ \}}
\DoxyCodeLine{00061\ }
\DoxyCodeLine{00062\ \textcolor{comment}{//Returns\ 0\ for\ 48k,\ 1\ for\ 96k,\ and\ 2\ for\ 192k\ gross\ samples\ rate.}}
\DoxyCodeLine{00063\ \textcolor{keyword}{inline}\ \textcolor{keywordtype}{int}\ \mbox{\hyperlink{a00860_a149fe437454807a2d3edacf8de72c2a1}{CoarseSampleRateIndex}}\ (\textcolor{keywordtype}{int}\ iRate)}
\DoxyCodeLine{00064\ \{}
\DoxyCodeLine{00065\ \textcolor{comment}{//\ \ const\ long\ kMinGrossSampleRate=eSRUtils\_48kRangeCoarse;}}
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keywordtype}{int}\ aGrossRateIndex\ =\ 0;}
\DoxyCodeLine{00067\ }
\DoxyCodeLine{00068\ \ \ \ \ \textcolor{keywordflow}{switch}\ (\ \mbox{\hyperlink{a00860_ab463c18c13ba2c75b89da6c90f02d0f0}{CoarseSampleRate}}\ (iRate)\ )}
\DoxyCodeLine{00069\ \ \ \ \ \{}
\DoxyCodeLine{00070\ \ \ \ \ \textcolor{keywordflow}{default}:}
\DoxyCodeLine{00071\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eae974abf255ac5507a0c8163d0ebf9bcb}{eSRUtils\_48kRangeCoarse}}:}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \ \ \ \ aGrossRateIndex\ =\ 0;}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3ea376e9c46e970aa93e789445670b1d45f}{eSRUtils\_96kRangeCoarse}}:}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ \ \ \ \ aGrossRateIndex\ =\ 1;}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{case}\ \mbox{\hyperlink{a00860_a65f189058b3204334c2c13d368d8ce3eadc3653ea09f8a83c8222afc5a386e28f}{eSRUtils\_192kRangeCoarse}}:}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \ \ \ \ aGrossRateIndex\ =\ 2;}
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordflow}{break};}
\DoxyCodeLine{00080\ \textcolor{comment}{//\ \ \ \ \ \ default:}}
\DoxyCodeLine{00081\ \textcolor{comment}{//\ \ \ \ \ \ \ \ \ \ throw\ std::runtime\_error\ ("{}unrecognized\ sample\ rate"{});}}
\DoxyCodeLine{00082\ \ \ \ \ \}}
\DoxyCodeLine{00083\ }
\DoxyCodeLine{00084\ \ \ \ \ \textcolor{keywordflow}{return}\ aGrossRateIndex;}
\DoxyCodeLine{00085\ \}}

\end{DoxyCode}
