Reverted: dc87ef1a34b6 Parameter distMax depends on fixed values in sheets and other code. Using this to switch between rolloff and minimum sound is likely causing the glitchy sound volumes of background sounds. Must be fixed in whatever code is using too large value of distMax instead, and not here.

--HG--
branch : sound_dev
This commit is contained in:
kaetemi 2012-04-09 19:03:48 +02:00
parent afdbc97039
commit 87ba382ef5

View file

@ -26,15 +26,12 @@ namespace NLSOUND
// common method used only with OptionManualRolloff. return the volume in 1/100th DB ( = mB) modified // common method used only with OptionManualRolloff. return the volume in 1/100th DB ( = mB) modified
sint32 ISource::computeManualRollOff(sint32 volumeMB, sint32 mbMin, sint32 mbMax, double alpha, float sqrdist, float distMin, float distMax) sint32 ISource::computeManualRollOff(sint32 volumeMB, sint32 mbMin, sint32 mbMax, double alpha, float sqrdist, float distMin, float distMax)
{ {
// root square of max float value
static float maxSqrt = sqrt(std::numeric_limits<float>::max());
if (sqrdist < distMin * distMin) if (sqrdist < distMin * distMin)
{ {
// no attenuation // no attenuation
return volumeMB; return volumeMB;
} }
else if ((distMax < maxSqrt) && (sqrdist > distMax * distMax)) else if (sqrdist > distMax * distMax)
{ {
// full attenuation // full attenuation
return mbMin; return mbMin;