Crash with new OpenAL sound library

I converted HelloIntersection to use OpenAL, but unfortunately it’ll crash if you fire the bullet twice. I’m experiencing an identical crash in my game also (except it crashes instantly, without even firing once).


java.nio.BufferOverflowException
        at java.nio.Buffer.nextPutIndex(Buffer.java:419)
        at java.nio.DirectFloatBufferU.put(DirectFloatBufferU.java:245)
        at com.jme.sound.openAL.objects.Sample3D.setPosition(Unknown Source)
        at com.jme.sound.openAL.SoundSystem.setSamplePosition(Unknown Source)
        at jmetest.TutorialGuide.HelloIntersection$FireBullet.performAction(Unknown Source)
        at com.jme.input.InputHandler.update(Unknown Source)
        at com.jme.app.SimpleGame.update(Unknown Source)
        at com.jme.app.BaseGame.start(Unknown Source)
        at jmetest.TutorialGuide.HelloIntersection.main(Unknown Source)

To fix: the setPosition method in Sample3D in the OpenAL package needs to be set to this:

public void setPosition(float x, float y, float z){
       position.clear();
        position.put(x);
        position.put(y);
        position.put(z);
        positionChanged=true;
       
    }

done