| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 | 30 |
| 31 #if ENABLE(WEB_AUDIO) | 31 #if ENABLE(WEB_AUDIO) |
| 32 | 32 |
| 33 #include "platform/audio/HRTFDatabase.h" | 33 #include "platform/audio/HRTFDatabase.h" |
| 34 | 34 |
| 35 | 35 |
| 36 using namespace std; | 36 using namespace std; |
| 37 | 37 |
| 38 namespace WebCore { | 38 namespace blink { |
| 39 | 39 |
| 40 const int HRTFDatabase::MinElevation = -45; | 40 const int HRTFDatabase::MinElevation = -45; |
| 41 const int HRTFDatabase::MaxElevation = 90; | 41 const int HRTFDatabase::MaxElevation = 90; |
| 42 const unsigned HRTFDatabase::RawElevationAngleSpacing = 15; | 42 const unsigned HRTFDatabase::RawElevationAngleSpacing = 15; |
| 43 const unsigned HRTFDatabase::NumberOfRawElevations = 10; // -45 -> +90 (each 15
degrees) | 43 const unsigned HRTFDatabase::NumberOfRawElevations = 10; // -45 -> +90 (each 15
degrees) |
| 44 const unsigned HRTFDatabase::InterpolationFactor = 1; | 44 const unsigned HRTFDatabase::InterpolationFactor = 1; |
| 45 const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * I
nterpolationFactor; | 45 const unsigned HRTFDatabase::NumberOfTotalElevations = NumberOfRawElevations * I
nterpolationFactor; |
| 46 | 46 |
| 47 PassOwnPtr<HRTFDatabase> HRTFDatabase::create(float sampleRate) | 47 PassOwnPtr<HRTFDatabase> HRTFDatabase::create(float sampleRate) |
| 48 { | 48 { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle) | 111 unsigned HRTFDatabase::indexFromElevationAngle(double elevationAngle) |
| 112 { | 112 { |
| 113 // Clamp to allowed range. | 113 // Clamp to allowed range. |
| 114 elevationAngle = max(static_cast<double>(MinElevation), elevationAngle); | 114 elevationAngle = max(static_cast<double>(MinElevation), elevationAngle); |
| 115 elevationAngle = min(static_cast<double>(MaxElevation), elevationAngle); | 115 elevationAngle = min(static_cast<double>(MaxElevation), elevationAngle); |
| 116 | 116 |
| 117 unsigned elevationIndex = static_cast<int>(InterpolationFactor * (elevationA
ngle - MinElevation) / RawElevationAngleSpacing); | 117 unsigned elevationIndex = static_cast<int>(InterpolationFactor * (elevationA
ngle - MinElevation) / RawElevationAngleSpacing); |
| 118 return elevationIndex; | 118 return elevationIndex; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace WebCore | 121 } // namespace blink |
| 122 | 122 |
| 123 #endif // ENABLE(WEB_AUDIO) | 123 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |