Mercurial > games > semicongine
changeset 177:42e99cb20da2
fix: remove potential raise
author | Sam <sam@basx.dev> |
---|---|
date | Tue, 02 May 2023 02:28:47 -0700 |
parents | 36e10cc04a33 |
children | 88198b0afacc 4293eb730430 |
files | src/semicongine/platform/windows/audio.nim |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/semicongine/platform/windows/audio.nim Tue May 02 02:13:46 2023 +0700 +++ b/src/semicongine/platform/windows/audio.nim Tue May 02 02:28:47 2023 -0700 @@ -36,12 +36,13 @@ reserved: DWORD_PTR(0) ) checkWinMMResult waveOutPrepareHeader(result.handle, addr result.buffer, UINT(sizeof(WAVEHDR))) - + +# add double buffering: https://stackoverflow.com/questions/49605552/double-buffered-waveoutwrite-stuttering-like-hell proc writeSoundData*(soundDevice: var NativeSoundDevice) = checkWinMMResult waveOutWrite(soundDevice.handle, addr soundDevice.buffer, UINT(sizeof(WAVEHDR))) while (soundDevice.buffer.dwFlags and WHDR_DONE) != 1: discard proc closeSoundDevice*(soundDevice: var NativeSoundDevice) = - checkWinMMResult waveOutUnprepareHeader(soundDevice.handle, addr soundDevice.buffer, UINT(sizeof(WAVEHDR))) + discard waveOutUnprepareHeader(soundDevice.handle, addr soundDevice.buffer, UINT(sizeof(WAVEHDR))) waveOutClose(soundDevice.handle)