| AAX SDK 2.6.1 Avid Audio Extensions Development Kit

- Welcome
- Manual
- Classes
- Files
- Lists
- Support

- File List
- File Members

Loading...
Searching...
No Matches
AAX_SampleRateUtils.h
Go to the documentation of this file.
1/*================================================================================================*/
2/*
3 * Copyright 2009-2015, 2023 Avid Technology, Inc.
4 * All rights reserved.
5 *
6 * CONFIDENTIAL: this document contains confidential information of Avid. Do
7 * not disclose to any third party. Use of the information contained in this
8 * document is subject to an Avid SDK license.
9 */
10
17/*================================================================================================*/
18#pragma once
19
20 enum ESRUtils
21{
22 eSRUtils_48kRangeCoarse = 48000,
23 eSRUtils_96kRangeCoarse = 96000,
24 eSRUtils_192kRangeCoarse = 192000,
25 eSRUtils_48kRangeMin = 0,
26 eSRUtils_48kRangeMax = 51000,
27 eSRUtils_96kRangeMin = eSRUtils_48kRangeMax+1,
28 eSRUtils_96kRangeMax = 102000,
29 eSRUtils_192kRangeMin = eSRUtils_96kRangeMax+1,
30 eSRUtils_192kRangeMax = 204000,
31 eSRUtils_48kIndex = 0,
32 eSRUtils_96kIndex = 1,
33 eSRUtils_192kIndex = 2
34};
35
36 inline int CoarseSampleRate (int iRate)
37{
38 const int aCoarseRate =
39
40 ((iRate >= eSRUtils_48kRangeMin) && (iRate <= eSRUtils_48kRangeMax)) ? eSRUtils_48kRangeCoarse :
41 ((iRate >= eSRUtils_96kRangeMin) && (iRate <= eSRUtils_96kRangeMax)) ? eSRUtils_96kRangeCoarse :
42 ((iRate >= eSRUtils_192kRangeMin) && (iRate <= eSRUtils_192kRangeMax)) ? eSRUtils_192kRangeCoarse :
43 0;
44
45 if (aCoarseRate == 0)
46 {
47// throw std::runtime_error ("unrecognized sample rate");
48 }
49 return aCoarseRate;
50}
51
52//Returns 1 for 48k, 2 for 96k, and 4 for 192k gross samples rate.
53 inline int CoarseSampleRateFactor (int iRate)
54{
55 const int kMinCoarseSampleRate=eSRUtils_48kRangeCoarse;
56
57 int aCoarseRateFactor = CoarseSampleRate (iRate)/kMinCoarseSampleRate;
58
59 return aCoarseRateFactor;
60}
61
62//Returns 0 for 48k, 1 for 96k, and 2 for 192k gross samples rate.
63 inline int CoarseSampleRateIndex (int iRate)
64{
65// const long kMinGrossSampleRate=eSRUtils_48kRangeCoarse;
66 int aGrossRateIndex = 0;
67
68 switch ( CoarseSampleRate (iRate) )
69 {
70 default:
71 case eSRUtils_48kRangeCoarse:
72 aGrossRateIndex = 0;
73 break;
74 case eSRUtils_96kRangeCoarse:
75 aGrossRateIndex = 1;
76 break;
77 case eSRUtils_192kRangeCoarse:
78 aGrossRateIndex = 2;
79 break;
80// default:
81// throw std::runtime_error ("unrecognized sample rate");
82 }
83
84 return aGrossRateIndex;
85}
CoarseSampleRateIndex
int CoarseSampleRateIndex(int iRate)
Definition: AAX_SampleRateUtils.h:63
ESRUtils
ESRUtils
Definition: AAX_SampleRateUtils.h:21
eSRUtils_96kIndex
@ eSRUtils_96kIndex
Definition: AAX_SampleRateUtils.h:32
eSRUtils_48kRangeMax
@ eSRUtils_48kRangeMax
Definition: AAX_SampleRateUtils.h:26
eSRUtils_96kRangeCoarse
@ eSRUtils_96kRangeCoarse
Definition: AAX_SampleRateUtils.h:23
eSRUtils_192kRangeMin
@ eSRUtils_192kRangeMin
Definition: AAX_SampleRateUtils.h:29
eSRUtils_96kRangeMin
@ eSRUtils_96kRangeMin
Definition: AAX_SampleRateUtils.h:27
eSRUtils_48kIndex
@ eSRUtils_48kIndex
Definition: AAX_SampleRateUtils.h:31
eSRUtils_192kRangeMax
@ eSRUtils_192kRangeMax
Definition: AAX_SampleRateUtils.h:30
eSRUtils_96kRangeMax
@ eSRUtils_96kRangeMax
Definition: AAX_SampleRateUtils.h:28
eSRUtils_192kRangeCoarse
@ eSRUtils_192kRangeCoarse
Definition: AAX_SampleRateUtils.h:24
eSRUtils_48kRangeCoarse
@ eSRUtils_48kRangeCoarse
Definition: AAX_SampleRateUtils.h:22
eSRUtils_48kRangeMin
@ eSRUtils_48kRangeMin
Definition: AAX_SampleRateUtils.h:25
eSRUtils_192kIndex
@ eSRUtils_192kIndex
Definition: AAX_SampleRateUtils.h:33
CoarseSampleRateFactor
int CoarseSampleRateFactor(int iRate)
Definition: AAX_SampleRateUtils.h:53
CoarseSampleRate
int CoarseSampleRate(int iRate)
Definition: AAX_SampleRateUtils.h:36