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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 unsigned j = (i + InterpolationFactor); | 69 unsigned j = (i + InterpolationFactor); |
70 if (j >= NumberOfTotalElevations) | 70 if (j >= NumberOfTotalElevations) |
71 j = i; // for last elevation interpolate with itself | 71 j = i; // for last elevation interpolate with itself |
72 | 72 |
73 // Create the interpolated convolution kernels and delays. | 73 // Create the interpolated convolution kernels and delays. |
74 for (unsigned jj = 1; jj < InterpolationFactor; ++jj) { | 74 for (unsigned jj = 1; jj < InterpolationFactor; ++jj) { |
75 float x = | 75 float x = |
76 static_cast<float>(jj) / static_cast<float>(InterpolationFactor); | 76 static_cast<float>(jj) / static_cast<float>(InterpolationFactor); |
77 m_elevations[i + jj] = HRTFElevation::createByInterpolatingSlices( | 77 m_elevations[i + jj] = HRTFElevation::createByInterpolatingSlices( |
78 m_elevations[i].get(), m_elevations[j].get(), x, sampleRate); | 78 m_elevations[i].get(), m_elevations[j].get(), x, sampleRate); |
79 ASSERT(m_elevations[i + jj].get()); | 79 DCHECK(m_elevations[i + jj].get()); |
80 } | 80 } |
81 } | 81 } |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 void HRTFDatabase::getKernelsFromAzimuthElevation(double azimuthBlend, | 85 void HRTFDatabase::getKernelsFromAzimuthElevation(double azimuthBlend, |
86 unsigned azimuthIndex, | 86 unsigned azimuthIndex, |
87 double elevationAngle, | 87 double elevationAngle, |
88 HRTFKernel*& kernelL, | 88 HRTFKernel*& kernelL, |
89 HRTFKernel*& kernelR, | 89 HRTFKernel*& kernelR, |
(...skipping 29 matching lines...) Expand all Loading... |
119 elevationAngle = | 119 elevationAngle = |
120 clampTo<double, double>(elevationAngle, MinElevation, MaxElevation); | 120 clampTo<double, double>(elevationAngle, MinElevation, MaxElevation); |
121 | 121 |
122 unsigned elevationIndex = | 122 unsigned elevationIndex = |
123 static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) / | 123 static_cast<int>(InterpolationFactor * (elevationAngle - MinElevation) / |
124 RawElevationAngleSpacing); | 124 RawElevationAngleSpacing); |
125 return elevationIndex; | 125 return elevationIndex; |
126 } | 126 } |
127 | 127 |
128 } // namespace blink | 128 } // namespace blink |
OLD | NEW |