Play sounds once only

im trying to get a gun firing sound to play only once, my problem is that the sound does correspond to the pressing of the mouse button, but after the first sound is played, the bullet firing sound repeats over and over



im using an onevent method:

SoundSystem.onEvent(WeaponMachineGun.getMP5SoundNode(), WeaponMachineGun.PrimFireMP5Event)



this is in a perform action method.

im having the same problem when the bullet collides with the terrain, i can then stop the bullet sound using:

SoundSystem.stopAllSamples();

but the terrain noise then plays and repeats over and over

im not using the newer version ive seen posts about (ive downloaded the nightly build but the imports statements for AudioTrack are giving errors) so does anyone familiar with the older version know of a fix for this??



because the sounds play over and over its a really annoying part to work on!!!

Do you have to use nodes for your project? If you just want them to sound the same no matter where you are, samples are really easy:



init()

{

    int sound=SoundSystem.create3DSample(Main.class.getClassLoader().

getResource("sound.ogg"));

}



update()

{

    if (mouseWasClicked && !SoundSystem.isSamplePlaying(Adam.affirm_snd)

        SoundSystem.playSample(sound);

}