win32: make sure sample count is even

This commit is contained in:
OV2 2016-11-06 22:05:10 +01:00
parent 1fb5d790e3
commit a76837a4f2
2 changed files with 4 additions and 2 deletions

View File

@ -314,7 +314,8 @@ bool CDirectSound::InitSoundBuffer()
blockCount = 4;
blockTime = GUI.SoundBufferSize / blockCount;
blockSamples = (Settings.SoundPlaybackRate * blockTime * (Settings.Stereo ? 2 : 1)) / 1000;
blockSamples = (Settings.SoundPlaybackRate * blockTime) / 1000;
blockSamples *= (Settings.Stereo ? 2 : 1);
blockSize = blockSamples * (Settings.SixteenBitSound ? 2 : 1);
bufferSize = blockSize * blockCount;

View File

@ -355,7 +355,8 @@ bool CXAudio2::SetupSound()
blockCount = 8;
UINT32 blockTime = GUI.SoundBufferSize / blockCount;
singleBufferSamples = (Settings.SoundPlaybackRate * blockTime * (Settings.Stereo ? 2 : 1)) / 1000;
singleBufferSamples = (Settings.SoundPlaybackRate * blockTime) / 1000;
singleBufferSamples *= (Settings.Stereo ? 2 : 1);
singleBufferBytes = singleBufferSamples * (Settings.SixteenBitSound ? 2 : 1);
sum_bufferSize = singleBufferBytes * blockCount;