# HG changeset patch # User Sam # Date 1682963363 -25200 # Node ID c5ff8f88c4a057f2cabf3ada600b6a16462d0f51 # Parent f3b723eb89d596126521a68d83aa91aa2e10bfb3 did: fix default sample rate, correct waiting for windows waveout processing diff -r f3b723eb89d5 -r c5ff8f88c4a0 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 f3b723eb89d5 -r c5ff8f88c4a0 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)