| 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 26 matching lines...) Expand all Loading... |
| 37 const int HRTFDatabase::MinElevation = -45; | 37 const int HRTFDatabase::MinElevation = -45; |
| 38 const int HRTFDatabase::MaxElevation = 90; | 38 const int HRTFDatabase::MaxElevation = 90; |
| 39 const unsigned HRTFDatabase::RawElevationAngleSpacing = 15; | 39 const unsigned HRTFDatabase::RawElevationAngleSpacing = 15; |
| 40 const unsigned HRTFDatabase::NumberOfRawElevations = | 40 const unsigned HRTFDatabase::NumberOfRawElevations = |
| 41 10; // -45 -> +90 (each 15 degrees) | 41 10; // -45 -> +90 (each 15 degrees) |
| 42 const unsigned HRTFDatabase::InterpolationFactor = 1; | 42 const unsigned HRTFDatabase::InterpolationFactor = 1; |
| 43 const unsigned HRTFDatabase::NumberOfTotalElevations = | 43 const unsigned HRTFDatabase::NumberOfTotalElevations = |
| 44 NumberOfRawElevations * InterpolationFactor; | 44 NumberOfRawElevations * InterpolationFactor; |
| 45 | 45 |
| 46 std::unique_ptr<HRTFDatabase> HRTFDatabase::create(float sampleRate) { | 46 std::unique_ptr<HRTFDatabase> HRTFDatabase::create(float sampleRate) { |
| 47 return wrapUnique(new HRTFDatabase(sampleRate)); | 47 return WTF::wrapUnique(new HRTFDatabase(sampleRate)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 HRTFDatabase::HRTFDatabase(float sampleRate) | 50 HRTFDatabase::HRTFDatabase(float sampleRate) |
| 51 : m_elevations(NumberOfTotalElevations), m_sampleRate(sampleRate) { | 51 : m_elevations(NumberOfTotalElevations), m_sampleRate(sampleRate) { |
| 52 unsigned elevationIndex = 0; | 52 unsigned elevationIndex = 0; |
| 53 for (int elevation = MinElevation; elevation <= MaxElevation; | 53 for (int elevation = MinElevation; elevation <= MaxElevation; |
| 54 elevation += RawElevationAngleSpacing) { | 54 elevation += RawElevationAngleSpacing) { |
| 55 std::unique_ptr<HRTFElevation> hrtfElevation = | 55 std::unique_ptr<HRTFElevation> hrtfElevation = |
| 56 HRTFElevation::createForSubject("Composite", elevation, sampleRate); | 56 HRTFElevation::createForSubject("Composite", elevation, sampleRate); |
| 57 ASSERT(hrtfElevation.get()); | 57 ASSERT(hrtfElevation.get()); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |