From 8790df1ef02f5cfe65215e5d28e32af82e3a1789 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;