diff options
author | Chris Robinson <[email protected]> | 2012-03-04 05:44:37 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-03-04 05:44:37 -0800 |
commit | 302c08a14bf10a97fa607efbaa7b15f7d2e1bc4a (patch) | |
tree | 3457062987945f1edc12d3fb5a169e1b86b4a7b6 | |
parent | b643f13a6e96df0332d9b0ff66b411c605d52919 (diff) |
Enforce range limits on periods and period_size.
-rw-r--r-- | Alc/ALc.c | 4 | ||||
-rw-r--r-- | alsoftrc.sample | 5 |
2 files changed, 5 insertions, 4 deletions
@@ -2583,10 +2583,10 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) } ConfigValueUInt(NULL, "periods", &device->NumUpdates); - if(device->NumUpdates < 2) device->NumUpdates = 4; + device->NumUpdates = clampu(device->NumUpdates, 2, 16); ConfigValueUInt(NULL, "period_size", &device->UpdateSize); - if(device->UpdateSize == 0) device->UpdateSize = 1024; + device->UpdateSize = clampu(device->UpdateSize, 64, 8192); ConfigValueUInt(NULL, "sources", &device->MaxNoOfSources); if(device->MaxNoOfSources == 0) device->MaxNoOfSources = 256; diff --git a/alsoftrc.sample b/alsoftrc.sample index f18860a5..93a48232 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -72,13 +72,14 @@ ## period_size: # Sets the update period size, in frames. This is the number of frames needed -# for each mixing update. +# for each mixing update. Acceptable values range between 64 and 8192. #period_size = 1024 ## periods: # Sets the number of update periods. Higher values create a larger mix ahead, # which helps protect against skips when the CPU is under load, but increases -# the delay between a sound getting mixed and being heard. +# the delay between a sound getting mixed and being heard. Acceptable values +# range between 2 and 16. #periods = 4 ## sources: |