mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-23 15:46:18 +00:00
Changed: Also handle distMax with negative alpha in new manual rolloff function
--HG-- branch : sound_dev
This commit is contained in:
parent
2fc601c556
commit
6bc3ef2ba6
1 changed files with 11 additions and 3 deletions
|
@ -89,9 +89,17 @@ float ISource::computeManualRolloff(double alpha, float sqrdist, float distMin,
|
|||
float rolloff = distMin / dist;
|
||||
if (alpha <= -1.0f) return rolloff;
|
||||
|
||||
double mb = mbMin * (dist - distMin) / (distMax - distMin);
|
||||
float mbrolloff = (float)pow(10.0, (double)mb / 2000.0);
|
||||
return ((1.0 + alpha) * mbrolloff - alpha * rolloff);
|
||||
if (dist > distMax)
|
||||
{
|
||||
// full attenuation of mbrolloff
|
||||
return (-alpha * rolloff);
|
||||
}
|
||||
else
|
||||
{
|
||||
double mb = mbMin * (dist - distMin) / (distMax - distMin);
|
||||
float mbrolloff = (float)pow(10.0, (double)mb / 2000.0);
|
||||
return ((1.0 + alpha) * mbrolloff - alpha * rolloff);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue