Fix crackling when resampling audio

This commit is contained in:
Michael Steenbeek authored and GitHub committed 2025-11-16 13:55:44 +01:00
1 parent 140fed1086
commit 7f346d6c45
2 files changed
+2 -1

No files matched your search

+1
View File
@@ -13,6 +13,7 @@
- Fix: [#25488] Crash in headless mode.
- Fix: [#25494] The Go-Karts steep to flat track does not draw correctly in the flat side tunnel.
- Fix: [#25518] The virtual floor does not draw correctly if expanded on the positive x and y axes.
- Fix: [#25519] Crackling audio when sampling frequencies do not match.
- Fix: [objects#401] Round tunnels on down slopes glitch.
- Fix: [objects#404] Wooden Wild Mine cars incorrectly allow setting a third remap colour.
- Fix: [objects#408] Australian fountain sets have confusing naming.
+1 -1
View File
@@ -200,7 +200,7 @@ void AudioMixer::MixChannel(ISDLAudioChannel* channel, uint8_t* data, size_t len
// Read raw PCM from channel
int32_t readSamples = numSamples * rate;
auto readLength = static_cast<size_t>(readSamples / cvt.len_ratio) * outputByteRate;
auto readLength = static_cast<size_t>(ceil(readSamples / cvt.len_ratio)) * outputByteRate;
_channelBuffer.resize(readLength);
size_t bytesRead = channel->Read(_channelBuffer.data(), readLength);