Index: Source/platform/audio/HRTFPanner.cpp |
diff --git a/Source/platform/audio/HRTFPanner.cpp b/Source/platform/audio/HRTFPanner.cpp |
index bab33c8173f42faf16cff3bb267d22271e99306c..a43f0d0b1f19d3b8bde8e16aeaf7f999384f969f 100644 |
--- a/Source/platform/audio/HRTFPanner.cpp |
+++ b/Source/platform/audio/HRTFPanner.cpp |
@@ -77,8 +77,13 @@ 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. |
Raymond Toy
2014/09/08 20:01:49
Nit: Remove the sentence beginning with "We double
KhNo
2014/09/10 12:59:06
Done.
|
- ASSERT(sampleRate >= 44100 && sampleRate <= 96000.0); |
- return (sampleRate < 88200.0) ? 512 : 1024; |
+ ASSERT(sampleRate >= 3000 && sampleRate <= 192000); |
+ |
+ int impulseLength = 256; |
Raymond Toy
2014/09/08 20:01:49
Nit: I think I'd call this truncatedImpulseLength,
KhNo
2014/09/10 12:59:05
Done.
|
+ double ratio = sampleRate / 44100; |
Raymond Toy
2014/09/08 20:01:49
Nit: Rename ratio to sampleRateRatio (to kind of m
KhNo
2014/09/10 12:59:05
Done.
|
+ double resampledLength = impulseLength * ratio; |
+ |
+ return 2 * (1 << static_cast<unsigned>(log2(resampledLength))); |
} |
void HRTFPanner::reset() |