Index: Source/platform/audio/HRTFPanner.cpp |
diff --git a/Source/platform/audio/HRTFPanner.cpp b/Source/platform/audio/HRTFPanner.cpp |
index 63d9fc49628394fbba237fa1de46c6c77615b84d..0056652b106179d8ac338ddc71ee62bd60038c5e 100644 |
--- a/Source/platform/audio/HRTFPanner.cpp |
+++ b/Source/platform/audio/HRTFPanner.cpp |
@@ -45,6 +45,10 @@ const double MaxDelayTimeSeconds = 0.002; |
const int UninitializedAzimuth = -1; |
const unsigned RenderingQuantum = 128; |
+const float coefficientSampleRate = 11025.f; |
Raymond Toy
2014/07/30 16:49:38
Where does 11025 come from? I thought the HRTF dat
KhNo
2014/07/31 16:45:54
This value is just determined to calculate fftsize
Raymond Toy
2014/07/31 17:25:13
Might be better to split this into two parts. One
|
+const size_t minimumFFTSize = 128; |
+const size_t maximumFFTSize = 1024; |
+ |
HRTFPanner::HRTFPanner(float sampleRate, HRTFDatabaseLoader* databaseLoader) |
: Panner(PanningModelHRTF) |
, m_databaseLoader(databaseLoader) |
@@ -79,8 +83,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. |
- ASSERT(sampleRate >= 44100 && sampleRate <= 96000.0); |
- return (sampleRate < 88200.0) ? 512 : 1024; |
+ ASSERT(sampleRate >= 8000 && sampleRate <= 96000.0); |
+ |
+ size_t fftSize = minimumFFTSize; |
Raymond Toy
2014/07/30 16:49:38
This initial value seems useless since you give ff
KhNo
2014/07/31 16:45:54
Done.
|
+ fftSize = floor(sampleRate / coefficientSampleRate) * minimumFFTSize; |
+ fftSize = max(minimumFFTSize, fftSize); |
+ fftSize = min(maximumFFTSize, fftSize); |
+ return fftSize; |
Raymond Toy
2014/07/30 16:49:38
If we expand the sample rate to 192 kHz, will this
KhNo
2014/07/31 16:45:54
Yes, it can be. kMaxFFTPow2Size is 15 for Android,
Raymond Toy
2014/07/31 17:25:13
One other thing. Don't we need to make fftSize a p
|
} |
void HRTFPanner::reset() |