aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-02-21 17:19:02 -0800
committerChris Robinson <[email protected]>2017-02-21 17:23:54 -0800
commit2dd142fed006549655bd55d3dc80388fe7e36e2e (patch)
treeec40872af1b14794e7e248ceacecec35eb21ac0c
parentd3cc867bd42759cb8e294d691354187984f96ff4 (diff)
Make the "sends" config option act as a limit
Instead of forcing the device to always use the specified send count, it simply limits requests to it.
-rw-r--r--Alc/ALc.c24
-rw-r--r--alsoftrc.sample7
-rw-r--r--utils/alsoft-config/mainwindow.ui23
3 files changed, 24 insertions, 30 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index e33f397b..f91fc09b 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -1895,8 +1895,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->NumMonoSources = numMono;
device->NumStereoSources = numStereo;
- ConfigValueInt(NULL, NULL, "sends", &numSends);
- new_sends = clampi(numSends, 0, MAX_SENDS);
+ if(ConfigValueInt(NULL, NULL, "sends", &new_sends))
+ new_sends = clampi(numSends, 0, clampi(new_sends, 0, MAX_SENDS));
+ else
+ new_sends = clampi(numSends, 0, MAX_SENDS);
}
else if(attrList && attrList[0])
{
@@ -1977,8 +1979,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
device->NumMonoSources = numMono;
device->NumStereoSources = numStereo;
- ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &numSends);
- new_sends = clampi(numSends, 0, MAX_SENDS);
+ if(ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &new_sends))
+ new_sends = clampi(numSends, 0, clampi(new_sends, 0, MAX_SENDS));
+ else
+ new_sends = clampi(numSends, 0, MAX_SENDS);
}
if((device->Flags&DEVICE_RUNNING))
@@ -3736,8 +3740,10 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName)
ConfigValueUInt(deviceName, NULL, "slots", &device->AuxiliaryEffectSlotMax);
if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64;
- ConfigValueInt(deviceName, NULL, "sends", &device->NumAuxSends);
- device->NumAuxSends = clampi(device->NumAuxSends, 0, MAX_SENDS);
+ if(ConfigValueInt(deviceName, NULL, "sends", &device->NumAuxSends))
+ device->NumAuxSends = clampi(
+ DEFAULT_SENDS, 0, clampi(device->NumAuxSends, 0, MAX_SENDS)
+ );
device->NumStereoSources = 1;
device->NumMonoSources = device->SourcesMax - device->NumStereoSources;
@@ -4142,8 +4148,10 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN
ConfigValueUInt(NULL, NULL, "slots", &device->AuxiliaryEffectSlotMax);
if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64;
- ConfigValueInt(NULL, NULL, "sends", &device->NumAuxSends);
- device->NumAuxSends = clampi(device->NumAuxSends, 0, MAX_SENDS);
+ if(ConfigValueInt(NULL, NULL, "sends", &device->NumAuxSends))
+ device->NumAuxSends = clampi(
+ DEFAULT_SENDS, 0, clampi(device->NumAuxSends, 0, MAX_SENDS)
+ );
device->NumStereoSources = 1;
device->NumMonoSources = device->SourcesMax - device->NumStereoSources;
diff --git a/alsoftrc.sample b/alsoftrc.sample
index d676c8aa..3cc205b0 100644
--- a/alsoftrc.sample
+++ b/alsoftrc.sample
@@ -176,10 +176,9 @@
#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 16.
-#sends =
+# Limits the number of auxiliary sends allowed per source. Setting this higher
+# than the default has no effect.
+#sends = 16
## volume-adjust:
# A global volume adjustment for source output, expressed in decibels. The
diff --git a/utils/alsoft-config/mainwindow.ui b/utils/alsoft-config/mainwindow.ui
index b886dc00..e074d63b 100644
--- a/utils/alsoft-config/mainwindow.ui
+++ b/utils/alsoft-config/mainwindow.ui
@@ -1585,14 +1585,8 @@ during updates.</string>
help for systems with apps that try to play more sounds than
the CPU can handle.</string>
</property>
- <property name="inputMask">
- <string/>
- </property>
<property name="maxLength">
- <number>3</number>
- </property>
- <property name="frame">
- <bool>true</bool>
+ <number>4</number>
</property>
<property name="placeholderText">
<string>256</string>
@@ -1645,15 +1639,9 @@ create. A slot 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.</string>
</property>
- <property name="inputMask">
- <string/>
- </property>
<property name="maxLength">
<number>3</number>
</property>
- <property name="frame">
- <bool>true</bool>
- </property>
<property name="placeholderText">
<string>64</string>
</property>
@@ -1684,15 +1672,14 @@ may help when apps use more than the system can handle.</string>
</rect>
</property>
<property name="toolTip">
- <string>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 16.</string>
+ <string>Limits the number of auxiliary sends allowed per source.
+Setting this higher than the default has no effect.</string>
</property>
<property name="maxLength">
- <number>1</number>
+ <number>2</number>
</property>
<property name="placeholderText">
- <string>Auto</string>
+ <string>16</string>
</property>
</widget>
<widget class="QGroupBox" name="cpuExtGroupBox">