From 9e05a0a69250520a22a6f0ef12cb07371dd9a667 Mon Sep 17 00:00:00 2001 From: doop <56421834+dooplecks@users.noreply.github.com> Date: Wed, 2 Sep 2026 03:55:28 +0000 Subject: [PATCH] Simplify resampling ratio calculation --- src/dusk/audio/DuskDsp.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/dusk/audio/DuskDsp.cpp b/src/dusk/audio/DuskDsp.cpp index 0122adbc43..3ea0c51623 100644 --- a/src/dusk/audio/DuskDsp.cpp +++ b/src/dusk/audio/DuskDsp.cpp @@ -101,13 +101,6 @@ static u32 ConvertSamplesToDataLength(const JASDsp::TChannel& channel, u32 sampl return (samples / channel.mSamplesPerBlock) * BlockBytes(channel); } -/** - * Converts a pitch value on a DSP channel to a sample rate. - */ -constexpr static int PitchToSampleRate(u16 value) { - return static_cast(static_cast(SampleRate) * value / 4096); -} - /** * Reset state for a DSP channel between independent playbacks. */ @@ -398,7 +391,7 @@ static void RenderChannel( } // how many input samples we step per output sample, aka the resampling ratio - f32 step = (f32)PitchToSampleRate(channel.mPitch) / SampleRate; + auto step = static_cast(channel.mPitch) / 4096.0f; // how many input samples to resample to DSP_SUBFRAME_SIZE output samples int needed = static_cast(channelAux.resamplePos + DSP_SUBFRAME_SIZE * step) + 2;