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.
This commit is contained in:
Chris Robinson
2017-02-21 17:19:02 -08:00
parent d3cc867bd4
commit 2dd142fed0
3 changed files with 24 additions and 30 deletions
+16 -8
View File
@@ -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;
+3 -4
View File
@@ -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
+5 -18
View File
@@ -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">