mirror of https://github.com/OpenTTD/OpenTTD.git
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:
parent
8fb26612c0
commit
25aeb1c5a5
|
@ -70,7 +70,7 @@ const char *SoundDriver_Win32::Start(const StringList &parm)
|
||||||
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
|
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
|
||||||
|
|
||||||
/* Limit buffer size to prevent overflows. */
|
/* Limit buffer size to prevent overflows. */
|
||||||
_bufsize = GetDriverParamInt(parm, "bufsize", 8192);
|
_bufsize = GetDriverParamInt(parm, "samples", 1024);
|
||||||
_bufsize = std::min<int>(_bufsize, UINT16_MAX);
|
_bufsize = std::min<int>(_bufsize, UINT16_MAX);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -205,7 +205,7 @@ const char *SoundDriver_XAudio2::Start(const StringList &parm)
|
||||||
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
|
wfex.nAvgBytesPerSec = wfex.nSamplesPerSec * wfex.nBlockAlign;
|
||||||
|
|
||||||
// Limit buffer size to prevent overflows
|
// 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);
|
bufsize = std::min<int>(bufsize, UINT16_MAX);
|
||||||
|
|
||||||
_voice_context = new StreamingVoiceContext(bufsize * 4);
|
_voice_context = new StreamingVoiceContext(bufsize * 4);
|
||||||
|
|
Loading…
Reference in New Issue