Change: Use same audio buffer size (and config parameter) for all sound drivers. (#12227)

Windows drivers used a default buffer size of 8192 instead of 1024, which results in a considerable 186ms latency.
This commit is contained in:
Peter Nelson 2024-03-07 23:19:59 +00:00 committed by GitHub
parent 8fb26612c0
commit 25aeb1c5a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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);