1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-19 04:53:12 +01:00

Fix crackling when resampling audio

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

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);