Our sound engine has a "falloff" function. (used to make the sound get quieter as the listener moves away from the sound) The relavent inputs we have in this function are:
distance (the distance from the sound to the listener)
min (the distance from the sound at which it starts getting quieter)
max (the distance from the sound at which it goes silent)
The function returns a float value between 0.0 and 1.0 with 1.0 meaning full volume and 0 meaning silent.
If the distance is less than min, we want the function to return 1.0. If the distance is greater than max, we want the function to return 0.0 (these 2 things are working)
What we want to happen if the distance is between min and max is that every time the distance between the listener and the sound is doubled, the volume falloff number is halved (so if the min distance is 1 then at a distance of 2 the return would be 0.50, at 4 it would be 0.25, at 8 it would be 12.5 etc). Can anyone help me with the math for this?