| 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 |
| 56 // 0 -> HRTFElevation::NumberOfTotalAzimuths - 1 |
| 57 // (corresponding to angles of 0 -> 360). |
| 54 // Valid values for elevationAngle are MinElevation -> MaxElevation. | 58 // Valid values for elevationAngle are MinElevation -> MaxElevation. |
| 55 void getKernelsFromAzimuthElevation(double azimuthBlend, | 59 void getKernelsFromAzimuthElevation(double azimuthBlend, |
| 56 unsigned azimuthIndex, | 60 unsigned azimuthIndex, |
| 57 double elevationAngle, | 61 double elevationAngle, |
| 58 HRTFKernel*& kernelL, | 62 HRTFKernel*& kernelL, |
| 59 HRTFKernel*& kernelR, | 63 HRTFKernel*& kernelR, |
| 60 double& frameDelayL, | 64 double& frameDelayL, |
| 61 double& frameDelayR); | 65 double& frameDelayR); |
| 62 | 66 |
| 63 // Returns the number of different azimuth angles. | 67 // Returns the number of different azimuth angles. |
| 64 static unsigned numberOfAzimuths() { | 68 static unsigned numberOfAzimuths() { |
| 65 return HRTFElevation::NumberOfTotalAzimuths; | 69 return HRTFElevation::NumberOfTotalAzimuths; |
| 66 } | 70 } |
| 67 | 71 |
| 68 float sampleRate() const { return m_sampleRate; } | 72 float sampleRate() const { return m_sampleRate; } |
| 69 | 73 |
| 70 // Number of elevations loaded from resource. | 74 // Number of elevations loaded from resource. |
| 71 static const unsigned NumberOfRawElevations; | 75 static const unsigned NumberOfRawElevations; |
| 72 | 76 |
| 73 private: | 77 private: |
| 74 explicit HRTFDatabase(float sampleRate); | 78 explicit HRTFDatabase(float sampleRate); |
| 75 | 79 |
| 76 // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase. | 80 // Minimum and maximum elevation angles (inclusive) for a HRTFDatabase. |
| 77 static const int MinElevation; | 81 static const int MinElevation; |
| 78 static const int MaxElevation; | 82 static const int MaxElevation; |
| 79 static const unsigned RawElevationAngleSpacing; | 83 static const unsigned RawElevationAngleSpacing; |
| 80 | 84 |
| 81 // Interpolates by this factor to get the total number of elevations from ever
y elevation loaded from resource. | 85 // Interpolates by this factor to get the total number of elevations from |
| 86 // every elevation loaded from resource. |
| 82 static const unsigned InterpolationFactor; | 87 static const unsigned InterpolationFactor; |
| 83 | 88 |
| 84 // Total number of elevations after interpolation. | 89 // Total number of elevations after interpolation. |
| 85 static const unsigned NumberOfTotalElevations; | 90 static const unsigned NumberOfTotalElevations; |
| 86 | 91 |
| 87 // Returns the index for the correct HRTFElevation given the elevation angle. | 92 // Returns the index for the correct HRTFElevation given the elevation angle. |
| 88 static unsigned indexFromElevationAngle(double); | 93 static unsigned indexFromElevationAngle(double); |
| 89 | 94 |
| 90 Vector<std::unique_ptr<HRTFElevation>> m_elevations; | 95 Vector<std::unique_ptr<HRTFElevation>> m_elevations; |
| 91 float m_sampleRate; | 96 float m_sampleRate; |
| 92 }; | 97 }; |
| 93 | 98 |
| 94 } // namespace blink | 99 } // namespace blink |
| 95 | 100 |
| 96 #endif // HRTFDatabase_h | 101 #endif // HRTFDatabase_h |
| OLD | NEW |