Change: Use same audio buffer size and config parameter for all sound drivers. #12227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Problem
For Allegro, SDL and SDLv2 sound drivers, the parameter to change audio frame size is
samples
, however for the two Windows sound drivers (win32 and xaudio2) the parameter is namedbufsize
.The default value for all drivers that use
samples
is1024
, but the default for drivers that usebufsize
is8192
.At 44100 Hz, these sizes provide a latency per buffer (usually there are at least 2 buffers) of 23 ms and 186 ms respectively.
Our audio mixer is limited to only playing 8 sound effects at once, and that limit applies to the whole buffer size. Therefore with a larger buffer size, it is more likely that mixer channels will be used up and new sounds get blocked from playing.
Description
Bring the two Windows driver in line by changing the parameter name to
samples
for all drivers, and change the default buffer size to1024
.Limitations
This does not touch the Cocoa driver, with how the macOS API works we don't actually set the buffer size and just use what we're given.
Checklist for review
Some things are not automated, and forgotten often. This list is a reminder for the reviewers.