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:
committed by
GitHub
parent
140fed1086
commit
7f346d6c45
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user