DirectSound: dynamically calculate block alignment to ensure correctness with various bit depths

This commit is contained in:
sukibaby
2025-06-10 21:13:35 -07:00
committed by teejusb
parent 6eb58bbd66
commit b933347374
+1 -1
View File
@@ -70,7 +70,7 @@ void DSound::SetPrimaryBufferMode()
preferredSampleRate = kFallbackSampleRate;
}
waveformat.nSamplesPerSec = preferredSampleRate;
waveformat.nBlockAlign = 4;
waveformat.nBlockAlign = (waveformat.nChannels * waveformat.wBitsPerSample) / 8;
waveformat.nAvgBytesPerSec = waveformat.nSamplesPerSec * waveformat.nBlockAlign;
// Set the primary buffer's format