From 3c4982edddfdba482204ed48cf0b1d41ccae5493 Mon Sep 17 00:00:00 2001 From: OV2 Date: Sun, 6 Nov 2022 02:12:28 +0100 Subject: [PATCH] msu1: return minimum available samples in resamplers --- apu/apu.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apu/apu.cpp b/apu/apu.cpp index 4c54f2b8..86af9c65 100644 --- a/apu/apu.cpp +++ b/apu/apu.cpp @@ -122,7 +122,10 @@ bool8 S9xMixSamples(uint8 *dest, int sample_count) int S9xGetSampleCount(void) { - return spc::resampler->avail(); + int avail = spc::resampler->avail(); + if (Settings.MSU1) // return minimum available samples, otherwise we can run into the assert above due to partial sample generation in msu1 + avail = Resampler::min(avail, msu::resampler->avail()); + return avail; } void S9xLandSamples(void)