Skip to content

Commit

Permalink
Change: Use same audio buffer size (and config parameter) for all sou…
Browse files Browse the repository at this point in the history
…nd drivers. (#12227)

Windows drivers used a default buffer size of 8192 instead of 1024, which results in a considerable 186ms latency.
  • Loading branch information
PeterN committed Mar 7, 2024
1 parent 8fb2661 commit 25aeb1c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sound/win32_s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const char *SoundDriver_Win32::Start(const StringList &parm)
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;

/* Limit buffer size to prevent overflows. */
_bufsize = GetDriverParamInt(parm, "bufsize", 8192);
_bufsize = GetDriverParamInt(parm, "samples", 1024);
_bufsize = std::min<int>(_bufsize, UINT16_MAX);

try {
Expand Down
2 changes: 1 addition & 1 deletion src/sound/xaudio2_s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const char *SoundDriver_XAudio2::Start(const StringList &parm)
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;

// Limit buffer size to prevent overflows
int bufsize = GetDriverParamInt(parm, "bufsize", 8192);
int bufsize = GetDriverParamInt(parm, "samples", 1024);
bufsize = std::min<int>(bufsize, UINT16_MAX);

_voice_context = new StreamingVoiceContext(bufsize * 4);
Expand Down

0 comments on commit 25aeb1c

Please sign in to comment.