Skip to content

Commit

Permalink
win32: make sure sample count is even
Browse files Browse the repository at this point in the history
  • Loading branch information
OV2 committed Nov 6, 2016
1 parent 1fb5d79 commit a76837a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion win32/CDirectSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion win32/CXAudio2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit a76837a

Please sign in to comment.