Jump to content

  • Log In with Google      Sign In   
  • Create Account


KCat

Member Since 15 Dec 2007
Offline Last Active Dec 18 2007 11:06 PM
-----

#4170357 OpenAL distance fade

Posted by KCat on 28 February 2008 - 02:49 PM

You also need to set the source's distances.
// The distance that the source will be the loudest (if the listener is
// closer, it won't be any louder than if they were at this distance)
alSourcei(source, AL_REFERENCE_DISTANCE, 1.0);
// The distance that the source will be the quietest (if the listener is
// farther, it won't be any quieter than if they were at this distance)
alSourcei(source, AL_MAX_DISTANCE, FLT_MAX);

The given values in that example are the defaults. As the listener moves between the reference and max distances from the source, the perceived volume will increase and decrease accordingly. And being that the max distance defaults to FLT_MAX, that's really far so it won't seem to quiet much as it moves away. Setting more reasonable max distances for the sources will make the distance fading more apparent (exactly what values are reasonable depends on your unit scale and how far away you'd prefer the sounds to be heard).


PARTNERS