From d3cc867bd42759cb8e294d691354187984f96ff4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 21 Feb 2017 16:54:55 -0800 Subject: [PATCH] Increase the default effect slot and send count The default number of auxiliary effect slots is now 64. This can still be raised by the config file without a hard maximum, but incurs processing cost for each effect slot generated by the app. The default number of source sends is now actually 2, as per the EFX docs. However, it can be raised up to 16 via ALC_MAX_AUXILIARY_SENDS attribute requests, rather than the previous 4. --- Alc/ALc.c | 28 +++++++++++++++------------- OpenAL32/Include/alSource.h | 3 ++- alsoftrc.sample | 4 ++-- utils/alsoft-config/mainwindow.cpp | 4 ++-- utils/alsoft-config/mainwindow.ui | 6 +++--- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/Alc/ALc.c b/Alc/ALc.c index e63323b4..e33f397b 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -1788,11 +1788,12 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) GotType = 1<<2, GotAll = GotFreq|GotChans|GotType }; - ALCuint freq, numMono, numStereo, numSends; + ALCuint freq, numMono, numStereo; enum DevFmtChannels schans; enum DevFmtType stype; ALCuint attrIdx = 0; ALCint gotFmt = 0; + ALCsizei numSends; if(!attrList) { @@ -1894,13 +1895,14 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->NumMonoSources = numMono; device->NumStereoSources = numStereo; - ConfigValueUInt(NULL, NULL, "sends", &numSends); - new_sends = clampi(numSends, 1, MAX_SENDS); + ConfigValueInt(NULL, NULL, "sends", &numSends); + new_sends = clampi(numSends, 0, MAX_SENDS); } else if(attrList && attrList[0]) { - ALCuint freq, numMono, numStereo, numSends; + ALCuint freq, numMono, numStereo; ALCuint attrIdx = 0; + ALCsizei numSends; /* If a context is already running on the device, stop playback so the * device attributes can be updated. */ @@ -1921,8 +1923,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(attrList[attrIdx] == ALC_FREQUENCY) { freq = attrList[attrIdx + 1]; - device->Flags |= DEVICE_FREQUENCY_REQUEST; TRACE_ATTR(ALC_FREQUENCY, freq); + device->Flags |= DEVICE_FREQUENCY_REQUEST; } if(attrList[attrIdx] == ALC_STEREO_SOURCES) @@ -1975,8 +1977,8 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->NumMonoSources = numMono; device->NumStereoSources = numStereo; - ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &numSends); - new_sends = clampi(numSends, 1, MAX_SENDS); + ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &numSends); + new_sends = clampi(numSends, 0, MAX_SENDS); } if((device->Flags&DEVICE_RUNNING)) @@ -3620,8 +3622,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) device->SamplesDone = 0; device->SourcesMax = 256; - device->AuxiliaryEffectSlotMax = 4; - device->NumAuxSends = MAX_SENDS; + device->AuxiliaryEffectSlotMax = 64; + device->NumAuxSends = DEFAULT_SENDS; InitUIntMap(&device->BufferMap, ~0); InitUIntMap(&device->EffectMap, ~0); @@ -3732,7 +3734,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(device->SourcesMax == 0) device->SourcesMax = 256; ConfigValueUInt(deviceName, NULL, "slots", &device->AuxiliaryEffectSlotMax); - if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; + if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64; ConfigValueInt(deviceName, NULL, "sends", &device->NumAuxSends); device->NumAuxSends = clampi(device->NumAuxSends, 0, MAX_SENDS); @@ -4107,8 +4109,8 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN device->SamplesDone = 0; device->SourcesMax = 256; - device->AuxiliaryEffectSlotMax = 4; - device->NumAuxSends = MAX_SENDS; + device->AuxiliaryEffectSlotMax = 64; + device->NumAuxSends = DEFAULT_SENDS; InitUIntMap(&device->BufferMap, ~0); InitUIntMap(&device->EffectMap, ~0); @@ -4138,7 +4140,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN if(device->SourcesMax == 0) device->SourcesMax = 256; ConfigValueUInt(NULL, NULL, "slots", &device->AuxiliaryEffectSlotMax); - if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; + if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64; ConfigValueInt(NULL, NULL, "sends", &device->NumAuxSends); device->NumAuxSends = clampi(device->NumAuxSends, 0, MAX_SENDS); diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 72b05fc8..8889ed24 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -1,7 +1,8 @@ #ifndef _AL_SOURCE_H_ #define _AL_SOURCE_H_ -#define MAX_SENDS 4 +#define MAX_SENDS 16 +#define DEFAULT_SENDS 2 #include "alMain.h" #include "alu.h" diff --git a/alsoftrc.sample b/alsoftrc.sample index 52e93ad1..d676c8aa 100644 --- a/alsoftrc.sample +++ b/alsoftrc.sample @@ -173,12 +173,12 @@ # can use a non-negligible amount of CPU time if an effect is set on it even # if no sources are feeding it, so this may help when apps use more than the # system can handle. -#slots = 4 +#slots = 64 ## sends: # Sets the number of auxiliary sends per source. When not specified (default), # it allows the app to request how many it wants. The maximum value currently -# possible is 4. +# possible is 16. #sends = ## volume-adjust: diff --git a/utils/alsoft-config/mainwindow.cpp b/utils/alsoft-config/mainwindow.cpp index e4dc10fc..200f6811 100644 --- a/utils/alsoft-config/mainwindow.cpp +++ b/utils/alsoft-config/mainwindow.cpp @@ -295,9 +295,9 @@ MainWindow::MainWindow(QWidget *parent) : mSourceCountValidator = new QIntValidator(0, 4096, this); ui->srcCountLineEdit->setValidator(mSourceCountValidator); - mEffectSlotValidator = new QIntValidator(0, 16, this); + mEffectSlotValidator = new QIntValidator(0, 64, this); ui->effectSlotLineEdit->setValidator(mEffectSlotValidator); - mSourceSendValidator = new QIntValidator(0, 4, this); + mSourceSendValidator = new QIntValidator(0, 16, this); ui->srcSendLineEdit->setValidator(mSourceSendValidator); mSampleRateValidator = new QIntValidator(8000, 192000, this); ui->sampleRateCombo->lineEdit()->setValidator(mSampleRateValidator); diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui index afb91996..b886dc00 100644 --- a/utils/alsoft-config/mainwindow.ui +++ b/utils/alsoft-config/mainwindow.ui @@ -1649,13 +1649,13 @@ may help when apps use more than the system can handle. - 1 + 3 true - 4 + 64 @@ -1686,7 +1686,7 @@ may help when apps use more than the system can handle. The number of auxiliary sends per source. When not specified, it allows the app to request how many it wants. The maximum -value currently possible is 4. +value currently possible is 16. 1 -- 2.11.4.GIT