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 15 matching lines...) Expand all Loading... |
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 */ | 27 */ |
28 | 28 |
29 #ifndef HRTFDatabase_h | 29 #ifndef HRTFDatabase_h |
30 #define HRTFDatabase_h | 30 #define HRTFDatabase_h |
31 | 31 |
32 #include "platform/audio/HRTFElevation.h" | 32 #include "platform/audio/HRTFElevation.h" |
33 #include "wtf/Allocator.h" | 33 #include "wtf/Allocator.h" |
34 #include "wtf/Forward.h" | 34 #include "wtf/Forward.h" |
35 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
36 #include "wtf/OwnPtr.h" | |
37 #include "wtf/PassRefPtr.h" | 36 #include "wtf/PassRefPtr.h" |
38 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
| 38 #include <memory> |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
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 public: | 47 public: |
48 static PassOwnPtr<HRTFDatabase> create(float sampleRate); | 48 static std::unique_ptr<HRTFDatabase> create(float sampleRate); |
49 | 49 |
50 // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and
an interpolated left and right frame delay for the given azimuth and elevation. | 50 // getKernelsFromAzimuthElevation() returns a left and right ear kernel, and
an interpolated left and right frame delay for the given azimuth and elevation. |
51 // azimuthBlend must be in the range 0 -> 1. | 51 // azimuthBlend must be in the range 0 -> 1. |
52 // Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimut
hs - 1 (corresponding to angles of 0 -> 360). | 52 // Valid values for azimuthIndex are 0 -> HRTFElevation::NumberOfTotalAzimut
hs - 1 (corresponding to angles of 0 -> 360). |
53 // Valid values for elevationAngle are MinElevation -> MaxElevation. | 53 // Valid values for elevationAngle are MinElevation -> MaxElevation. |
54 void getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthInd
ex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& f
rameDelayL, double& frameDelayR); | 54 void getKernelsFromAzimuthElevation(double azimuthBlend, unsigned azimuthInd
ex, double elevationAngle, HRTFKernel* &kernelL, HRTFKernel* &kernelR, double& f
rameDelayL, double& frameDelayR); |
55 | 55 |
56 // Returns the number of different azimuth angles. | 56 // Returns the number of different azimuth angles. |
57 static unsigned numberOfAzimuths() { return HRTFElevation::NumberOfTotalAzim
uths; } | 57 static unsigned numberOfAzimuths() { return HRTFElevation::NumberOfTotalAzim
uths; } |
58 | 58 |
(...skipping 12 matching lines...) Expand all Loading... |
71 | 71 |
72 // Interpolates by this factor to get the total number of elevations from ev
ery elevation loaded from resource. | 72 // Interpolates by this factor to get the total number of elevations from ev
ery elevation loaded from resource. |
73 static const unsigned InterpolationFactor; | 73 static const unsigned InterpolationFactor; |
74 | 74 |
75 // Total number of elevations after interpolation. | 75 // Total number of elevations after interpolation. |
76 static const unsigned NumberOfTotalElevations; | 76 static const unsigned NumberOfTotalElevations; |
77 | 77 |
78 // Returns the index for the correct HRTFElevation given the elevation angle
. | 78 // Returns the index for the correct HRTFElevation given the elevation angle
. |
79 static unsigned indexFromElevationAngle(double); | 79 static unsigned indexFromElevationAngle(double); |
80 | 80 |
81 Vector<OwnPtr<HRTFElevation>> m_elevations; | 81 Vector<std::unique_ptr<HRTFElevation>> m_elevations; |
82 float m_sampleRate; | 82 float m_sampleRate; |
83 }; | 83 }; |
84 | 84 |
85 } // namespace blink | 85 } // namespace blink |
86 | 86 |
87 #endif // HRTFDatabase_h | 87 #endif // HRTFDatabase_h |
OLD | NEW |