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..7309d0049a622086469d406f61052a967a0f9bdd 100644 |
| --- a/Source/platform/audio/HRTFPanner.cpp |
| +++ b/Source/platform/audio/HRTFPanner.cpp |
| @@ -45,6 +45,11 @@ const double MaxDelayTimeSeconds = 0.002; |
| const int UninitializedAzimuth = -1; |
| const unsigned RenderingQuantum = 128; |
| +// Support sample rate from 3 kHz to 192 kHz. |
|
Raymond Toy
2014/09/04 17:27:20
This comment seems unrelated to the following code
KhNo
2014/09/05 05:03:25
I changed logic to find correct fft size. Do not n
|
| +const size_t minfftSize = 32; |
| +const size_t maxfftSize = 4096; |
| +const float coefficientSampleRate = 2756.25f; |
|
Raymond Toy
2014/09/04 17:27:20
No trialing "f" required according to blink style.
KhNo
2014/09/05 05:03:25
Done.
|
| + |
| HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader) |
| : Panner(PanningModelHRTF) |
| , m_databaseLoader(databaseLoader) |
| @@ -79,8 +84,15 @@ 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.f && sampleRate <= 192000.f); |
|
Raymond Toy
2014/09/04 17:27:20
No ".f" allowed per blink style guide.
KhNo
2014/09/05 05:03:25
Done.
|
| + |
| + if (sampleRate < 3000.f) |
| + return minfftSize; |
| + if (sampleRate > 192000.f) |
| + return maxfftSize; |
| + |
| + int scale = floor(sampleRate / coefficientSampleRate); |
| + return scale * minfftSize; |
|
Raymond Toy
2014/09/04 17:27:20
Don't you need to make sure the returned FFT size
KhNo
2014/09/05 05:03:25
Yes, it is required. I think I missed it during up
|
| } |
| void HRTFPanner::reset() |