I want to control the way how the sound source volume fades out by distance, how can i do this?
Edit: I would also like to know how to scale the sound coordinate system accordingly: i dont want to hear some sound VERY far away from the source: now i would have to change my rendering code to scale coordinates to make it work as i want.
Edit2: Although, one solution could be to multiply my coordinates before i send them... but are there more elegant ways?
That'll be alDistanceModel(AL_LINEAR_DISTANCE)
or better alDistanceModel(AL_LINEAR_DISTANCE_CLAMPED)
, which will turn distant sources off entirely.
Read chapters 3.4.3 and 3.4.4 here. You also have to set the parameters in the formulas listed there (AL_MAX_DISTANCE
and AL_REFERENCE_DISTANCE
) for each source (alSourcef
).
If the parameters don't make sense, attenuation is turned off. If the sound is stereo, likewise (stereo is just that... stereo -- only mono sounds are 3D).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With