Simplify resampling ratio calculation

This commit is contained in:
doop
2026-09-02 03:55:28 +00:00
parent c03c3cb962
commit 9e05a0a692
+1 -8
View File
@@ -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<int>(static_cast<u64>(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<f32>(channel.mPitch) / 4096.0f;
// how many input samples to resample to DSP_SUBFRAME_SIZE output samples
int needed = static_cast<int>(channelAux.resamplePos + DSP_SUBFRAME_SIZE * step) + 2;