# HG changeset patch # User Sam # Date 1682963363 -25200 # Node ID 2a31a1785b4aae6d30c43c2bfe5a40a26163b708 # Parent 07e57fce1bebbfa3773eecdcad17debe167e6fb5 did: fix default sample rate, correct waiting for windows waveout processing diff -r 07e57fce1beb -r 2a31a1785b4a src/semicongine/audiotypes.nim --- a/src/semicongine/audiotypes.nim Tue May 02 00:34:10 2023 +0700 +++ b/src/semicongine/audiotypes.nim Tue May 02 00:49:23 2023 +0700 @@ -5,7 +5,7 @@ # # ffmpeg -i -f s16le -ac 2 -ar 48000 -acodec pcm_s16le -const SAMPLERATE* = 48000 +const SAMPLERATE* = 44100 const BUFFERSIZE* = 512 type diff -r 07e57fce1beb -r 2a31a1785b4a src/semicongine/platform/windows/audio.nim --- a/src/semicongine/platform/windows/audio.nim Tue May 02 00:34:10 2023 +0700 +++ b/src/semicongine/platform/windows/audio.nim Tue May 02 00:49:23 2023 +0700 @@ -38,6 +38,9 @@ ) checkWinMMResult waveOutPrepareHeader(soundDevice.handle, addr data, UINT(sizeof(WAVEHDR))) checkWinMMResult waveOutWrite(soundDevice.handle, addr data, UINT(sizeof(WAVEHDR))) + while (data.dwFlags and WHDR_DONE) != 1: + discard + checkWinMMResult waveOutUnprepareHeader(soundDevice.handle, addr data, UINT(sizeof(WAVEHDR))) proc closeSoundDevice*(soundDevice: NativeSoundDevice) = waveOutClose(soundDevice.handle)