For the love of everything, I have been at this for three hours.
OpenAL, when I move the listener, completely breaks the attenuation. I have NO idea why.
If I do not change listener settings, it works fine. But unfortunately, that is not a viable solution in a 3d game.
I have tried everything from normalizing the positions and velocities of all sound making components, to manually setting all of the attenuation settings. But changing any setting on the listener, without fail, always breaks the attenuation. I will hear sounds that are 100's of units away from me if I move the listener, as if its position has no effect.
I have even used the alGet parameters to check and see if the values are going through correctly. They are.
Each unit in the game is 1x1, so in many cases two entities will be around 100 units apart.
alListener3f(AL_POSITION, pos.x, pos.y, pos.z);
alListener3f(AL_VELOCITY, vel.x, vel.y, vel.z);
alListener(AL_ORIENTATION, system.listener.getOrientationBuffer());
alListenerf(AL_GAIN, system.listener.getMasterGain());
That is all the code in charge of changing the listener. The Master gain is 0.5f as instructed and the sounds themselves are 0.5 as well. The distance model is AL_LINEAR_DISTANCE_CLAMPED
, and the reference distance is 1f, and the max distance is 2f. Still, the attenuation does not work and placement makes no difference. When in LINEAR_DISTANCE_CLAMPED
mode, the distances do not work regardless. If I leave it as the default model, it will atleast work when I do not move the listener.
The orientation has been left as default (0, 0, -1f, 0, 1f, 0f)
No, my sound drivers are fine and this computer was built less than a month ago with the newest parts.
And yes, the sounds are in mono format.
Someone please help me.