From 139ff3a2b8250e72a12ad26fcb20407c75c94929 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 12 Feb 2025 21:08:25 -0800 Subject: [PATCH] HRTF DSP: Add gain correction to impulse resampler Impulses should be gain scaled roughly based on the sample ratio relative to the original impulses. Lower target sample rate means less impulses means gain goes up, higher target sample rate means more impulses so gain goes down. Somewhat simple, seems to work. Signed-off-by: Christopher Snowhill --- Audio/Chain/DSP/HeadphoneFilter.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/Audio/Chain/DSP/HeadphoneFilter.mm b/Audio/Chain/DSP/HeadphoneFilter.mm index 600bf2aa2..8953f2ba1 100644 --- a/Audio/Chain/DSP/HeadphoneFilter.mm +++ b/Audio/Chain/DSP/HeadphoneFilter.mm @@ -191,6 +191,7 @@ static impulseSetCache *_sharedController = nil; if(resampling) { sampleCountResampled = (uint32_t)(((double)sampleCountExact) * sampleRate / sampleRateOfSource); actualSampleCount = (uint32_t)(((double)actualSampleCount) * sampleRate / sampleRateOfSource); + io_spec.scale = sampleRateOfSource / sampleRate; } actualSampleCount = (actualSampleCount + 15) & ~15;