[Convolver] Normalize HRTF impulse when resampling
When resampling the impulse according to the playback rate, it becomes necessary to normalize the resulting impulse by the inverse of the sample ratio, as resampling adds more or less loudness by virtue of interpolating samples. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
7e0b7f2008
commit
50342891af
|
@ -256,6 +256,10 @@ static const int8_t speakers_to_hesuvi_14[11][2] = {
|
|||
free(impulseBuffer);
|
||||
impulseBuffer = resampledImpulse;
|
||||
sampleCount = (int)outputDone;
|
||||
|
||||
// Normalize resampled impulse by sample ratio
|
||||
float fSampleRatio = (float)sampleRatio;
|
||||
vDSP_vsdiv(impulseBuffer, 1, &fSampleRatio, impulseBuffer, 1, sampleCount * impulseChannels);
|
||||
}
|
||||
|
||||
channelCount = channels;
|
||||
|
|
Loading…
Reference in New Issue