diff options
author | Chris Robinson <[email protected]> | 2017-02-21 17:19:02 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2017-02-21 17:23:54 -0800 |
commit | 2dd142fed006549655bd55d3dc80388fe7e36e2e (patch) | |
tree | ec40872af1b14794e7e248ceacecec35eb21ac0c /Alc | |
parent | d3cc867bd42759cb8e294d691354187984f96ff4 (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.
Diffstat (limited to 'Alc')
-rw-r--r-- | Alc/ALc.c | 24 |
1 files changed, 16 insertions, 8 deletions
@@ -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; |