OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 30 matching lines...) Expand all Loading... | |
41 | 41 |
42 class HRTFKernel; | 42 class HRTFKernel; |
43 | 43 |
44 class PLATFORM_EXPORT HRTFDatabase { | 44 class PLATFORM_EXPORT HRTFDatabase { |
45 USING_FAST_MALLOC(HRTFDatabase); | 45 USING_FAST_MALLOC(HRTFDatabase); |
46 WTF_MAKE_NONCOPYABLE(HRTFDatabase); | 46 WTF_MAKE_NONCOPYABLE(HRTFDatabase); |
47 | 47 |
48 public: | 48 public: |
49 static std::unique_ptr<HRTFDatabase> create(float sampleRate); | 49 static std::unique_ptr<HRTFDatabase> create(float sampleRate); |
50 | 50 |
51 // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and a n interpolated left and right frame delay for the given azimuth and elevation. | 51 // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and |
52 // an interpolated left and right frame delay for the given azimuth and | |
53 // elevation. | |
52 // azimuthBlend must be in the range 0 -> 1. | 54 // azimuthBlend must be in the range 0 -> 1. |
53 // Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimuths - 1 (corresponding to angles of 0 -> 360). | 55 // Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimuths |
56 // - 1 (corresponding to angles of 0 -> 360). | |
dcheng
2016/10/03 01:21:04
Nit: this expression is a bit hard to parse correc
Nico
2016/10/03 02:15:24
Done.
| |
54 // Valid values for elevationAngle are MinElevation -> MaxElevation. | 57 // Valid values for elevationAngle are MinElevation -> MaxElevation. |
55 void getKernelsFromAzimuthElevation(double azimuthBlend, | 58 void getKernelsFromAzimuthElevation(double azimuthBlend, |
56 unsigned azimuthIndex, | 59 unsigned azimuthIndex, |
57 double elevationAngle, | 60 double elevationAngle, |
58 HRTFKernel*& kernelL, | 61 HRTFKernel*& kernelL, |
59 HRTFKernel*& kernelR, | 62 HRTFKernel*& kernelR, |
60 double& frameDelayL, | 63 double& frameDelayL, |
61 double& frameDelayR); | 64 double& frameDelayR); |
62 | 65 |
63 // Returns the number of different azimuth angles. | 66 // Returns the number of different azimuth angles. |
64 static unsigned numberOfAzimuths() { | 67 static unsigned numberOfAzimuths() { |
65 return HRTFElevation::NumberOfTotalAzimuths; | 68 return HRTFElevation::NumberOfTotalAzimuths; |
66 } | 69 } |
67 | 70 |
68 float sampleRate() const { return m_sampleRate; } | 71 float sampleRate() const { return m_sampleRate; } |
69 | 72 |
70 // Number of elevations loaded from resource. | 73 // Number of elevations loaded from resource. |
71 static const unsigned NumberOfRawElevations; | 74 static const unsigned NumberOfRawElevations; |
72 | 75 |
73 private: | 76 private: |
74 explicit HRTFDatabase(float sampleRate); | 77 explicit HRTFDatabase(float sampleRate); |
75 | 78 |
76 // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase. | 79 // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase. |
77 static const int MinElevation; | 80 static const int MinElevation; |
78 static const int MaxElevation; | 81 static const int MaxElevation; |
79 static const unsigned RawElevationAngleSpacing; | 82 static const unsigned RawElevationAngleSpacing; |
80 | 83 |
81 // Interpolates by this factor to get the total number of elevations from ever y elevation loaded from resource. | 84 // Interpolates by this factor to get the total number of elevations from |
85 // every elevation loaded from resource. | |
82 static const unsigned InterpolationFactor; | 86 static const unsigned InterpolationFactor; |
83 | 87 |
84 // Total number of elevations after interpolation. | 88 // Total number of elevations after interpolation. |
85 static const unsigned NumberOfTotalElevations; | 89 static const unsigned NumberOfTotalElevations; |
86 | 90 |
87 // Returns the index for the correct HRTFElevation given the elevation angle. | 91 // Returns the index for the correct HRTFElevation given the elevation angle. |
88 static unsigned indexFromElevationAngle(double); | 92 static unsigned indexFromElevationAngle(double); |
89 | 93 |
90 Vector<std::unique_ptr<HRTFElevation>> m_elevations; | 94 Vector<std::unique_ptr<HRTFElevation>> m_elevations; |
91 float m_sampleRate; | 95 float m_sampleRate; |
92 }; | 96 }; |
93 | 97 |
94 } // namespace blink | 98 } // namespace blink |
95 | 99 |
96 #endif // HRTFDatabase_h | 100 #endif // HRTFDatabase_h |
OLD | NEW |