Chromium Code Reviews| Index: Source/platform/audio/HRTFPanner.cpp |
| diff --git a/Source/platform/audio/HRTFPanner.cpp b/Source/platform/audio/HRTFPanner.cpp |
| index 04e410dba233decde70c91472d12cf7ba6103ab3..9ec5b9fbbbab99653a9ea41f22047095b487255a 100644 |
| --- a/Source/platform/audio/HRTFPanner.cpp |
| +++ b/Source/platform/audio/HRTFPanner.cpp |
| @@ -45,6 +45,8 @@ const double MaxDelayTimeSeconds = 0.002; |
| const int UninitializedAzimuth = -1; |
| const unsigned RenderingQuantum = 128; |
| +const size_t fftSizes[] = { 64, 128, 256, 512, 1024, 2048, 4096 }; |
| + |
| HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader) |
| : Panner(PanningModelHRTF) |
| , m_databaseLoader(databaseLoader) |
| @@ -79,8 +81,22 @@ size_t HRTFPanner::fftSizeForSampleRate(float sampleRate) |
| // The HRTF impulse responses (loaded as audio resources) are 512 sample-frames @44.1KHz. |
| // Currently, we truncate the impulse responses to half this size, but an FFT-size of twice impulse response size is needed (for convolution). |
| // So for sample rates around 44.1KHz an FFT size of 512 is good. We double the FFT-size only for sample rates at least double this. |
| - ASSERT(sampleRate >= 44100 && sampleRate <= 96000.0); |
| - return (sampleRate < 88200.0) ? 512 : 1024; |
| + ASSERT(sampleRate >= 3000 && sampleRate <= 192000); |
| + |
| + if (sampleRate <= 5512.5) |
| + return fftSizes[0]; |
|
Raymond Toy
2014/09/05 16:19:52
Why not just return 64 instead of looking it up in
KhNo
2014/09/05 20:18:14
Sorry, I misunderstood your previous comment. I fi
|
| + if (sampleRate <= 11025) |
| + return fftSizes[1]; |
| + if (sampleRate <= 22050) |
| + return fftSizes[2]; |
| + if (sampleRate <= 44100) |
| + return fftSizes[3]; |
| + if (sampleRate <= 88200) |
| + return fftSizes[4]; |
|
Raymond Toy
2014/09/05 16:19:52
There's a difference here. In the original the FFT
KhNo
2014/09/05 20:18:14
// So for sample rates around 44.1KHz an FFT size
KhNo
2014/09/05 20:22:52
Please ignore above my comment, there is mistakes
Raymond Toy
2014/09/05 20:28:04
Ok. I'm not saying my proposal is the best way, b
|
| + if (sampleRate <= 176400) |
| + return fftSizes[5]; |
| + |
| + return fftSizes[6]; |
| } |
| void HRTFPanner::reset() |