Slick2D, play sound at location

So, I need help with an algorithm for my 2D Game.

Say entity AA is emitting a sound. The strength of the emitting sound is determined by the distance between AA and BB(this could be the main character).
The further away they are, the weaker the sound is. The max distance(pass this distance and the sound volume is 0) is of course customizable.
The volume setting can be from 0.0 to 1.0.

Where and when to do these checks is not a problem. I know my engine and I can resolve that. How to check it is the problem.

There is a method in Slick2Ds Sound class called playAt(x, y, z) but it isn’t what I expected.

Maybe there already is a way to implement this with Slick2D?

I would recommend Pauls sound library for 3D sound, found here.

Sound System jPCT supports binding Listener to Camera, thats what I am looking for, right?

So, what is the issue? Unless I’m mistaken, you want the volume of audio to be proportional to the distance from the audio source.
Couldn’t you just use the distance formula?

As for using the distance to change the volume, just choose a maximum distance, say 100. Any further than that and the volume is 0. So, you divide the distance by 100, and that gives you a percentage which you can use as the volume.

So, if the distance is 50, then the math would give you .5, which would be what you need. Is that right?

Usually you can get away with taking the sum of the squares and not the square root, and it saves you a lot of computation. In this case, it’s not just an optimization to keep the distance squared, it’s actually essential, because loudness falls off exponentially with distance, not linearly.

That not really descriptive.

playAt(x, y, z) does EXACTLY what you want.
make sure your sound files are MONO or it simply wont work

Care to explain how the method works? What the parameters mean? The method is very poorly documented.

its been a while since I have used Slick.

z was always a certain value, probably 1f and then just use x and y for positioning.
0f x should be left, 1f x should be right and so on