LWJGL playing sound effects in the update method?

So I load my sounds with slick and need a way to play them in the update method of my game. My problem is that if I call the playAsSoundEffect method, it’s being called in the update method, so it’ll play the sound 60 times a second. I thought “Okay! I’ll just make a boolean to run it once! like this:”
if(!sound.isPlaying())
sound.playAsSoundEffect(1f, 1f, false);

Well that didn’t work, as it just plays it again once it finishes playing. How can I accomplish this, where I call like a play() method and the sound is played ONCE? All help is appreciated!

Have you ever heard what an event is? For example:


public class Game {

	private boolean wasDown;
	private Sound sound;
	
	public void update() {
		
		boolean down = Keyboard.isKeyDown(Keyboard.KEY_P);
		
		if(down && !wasDown) sound.play();
		
		wasDown = down;
	}
	
}

Or something like that…

Sorry my account status is really misleading. I’ve been coding for about 2 years now on and off and am very familiar with events XD. I’m also pretty new to this forum. Just couldn’t figure out how to play sounds in the update method without playing them 60 times a second. I resolved the issue with this code: (thanks to your help)

//plays crashing sound when two objects collide
if(ob1.intersects(ob2) && !played){
sound.play();
played = true;
}

played = false; //resets the sound for next time

Can’t believe I didn’t think of this sooner :o This doesn’t even deserve to be on this forum.