OpenAL sound does not correctly pan or update

Try this: First fix the OpenAL Sound3D’s setPosition function. Then change HelloIntersection.java to use OpenAL. Then run it. Don’t use the mouse when playing it. Press D to start moving to the right and while pressing it fire the weapon using F. If all goes incorrectly as planned, you should hear the sound coming from the right side (when it’s supposed to come from the left). Next try turning the camera using the mouse. You’ll notice that depending on which way the camera is facing, the sound either correctly pans, or incorrectly pans. You can basically turn around and then the sound will pan to the correct side.



Also, in my game the sound follows the camera. With this new version only the sound’s initial position is set; the sound does not move while playing. I think this is because the location of the sound is not checked after the sound is initially played. Maybe I’m doing something wrong?

can you show me how you update the sound position while moving with the camera?

Well, you should be able to notice what I mentioned in HelloIntersection yourself by changing the import to use openal, but in my code I simply do this every update:

SoundSystem.setSamplePosition(weaponSound, cam.getLocation().x,
                                       cam.getLocation().y,
                                       cam.getLocation().z);

No no you are right, The sound position is not updated once "fired", But i am not sure that this is a bug

Well, it used to work with the old version. Unless there’s another way of doing this, I’d definitely consider it a bug; how else am I going to have the sound of a gun firing follow the player? Or say the sound of the engines of a ship?